mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-20 12:19:39 +00:00
Fancy armour, sneaky armour.
This commit is contained in:
1 parent
574a524953
commit
590618087d
21 files changed
+254
-66
No files matched your search
@@ -33,6 +33,10 @@ public class ClientProxy extends CommonProxy {
|
||||
CosmicItemRenderer sparkly = new CosmicItemRenderer();
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_sword, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_helm, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_armor, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_pants, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_shoes, sparkly);
|
||||
|
||||
CompatClient.comprettify();
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@ package fox.spiteful.avaritia.items;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
import fox.spiteful.avaritia.render.ModelArmorInfinity;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import fox.spiteful.avaritia.PotionHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -19,10 +20,10 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -40,18 +41,22 @@ import java.util.List;
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.IPhantomInkable", modid = "Botania")
|
||||
})
|
||||
public class ItemArmorInfinity extends ItemArmor implements IGoggles, IRevealer, IVisDiscountGear, IPhantomInkable {
|
||||
public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, IGoggles, IRevealer, IVisDiscountGear, IPhantomInkable {
|
||||
|
||||
public static final ArmorMaterial infinite_armor = EnumHelper.addArmorMaterial("infinity", 9999, new int[]{6, 16, 12, 6}, 1000);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static final ModelArmorInfinity armorModel = new ModelArmorInfinity(1.0f);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static final ModelArmorInfinity legModel = new ModelArmorInfinity(0.5f).setLegs(true);
|
||||
public IIcon cosmicMask;
|
||||
public final int slot;
|
||||
|
||||
public ItemArmorInfinity(int slot){
|
||||
super(infinite_armor, 0, slot);
|
||||
this.slot = slot;
|
||||
setCreativeTab(Avaritia.tab);
|
||||
setUnlocalizedName("infinity_armor_" + slot);
|
||||
setTextureName("avaritia:infinity_armor_" + slot);
|
||||
@@ -60,13 +65,7 @@ public class ItemArmorInfinity extends ItemArmor implements IGoggles, IRevealer,
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
//if(slot == 2)
|
||||
// return "avaritia:textures/models/infinity_pants.png";
|
||||
//else
|
||||
if(Compat.botan && hasPhantomInk(stack))
|
||||
return "botania:textures/model/invisibleArmor.png";
|
||||
else
|
||||
return "avaritia:textures/models/infinity_armor.png";
|
||||
return "avaritia:textures/models/infinity_armor.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,7 +73,8 @@ public class ItemArmorInfinity extends ItemArmor implements IGoggles, IRevealer,
|
||||
super.setDamage(stack, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
if(armorType == 0){
|
||||
@@ -123,7 +123,8 @@ public class ItemArmorInfinity extends ItemArmor implements IGoggles, IRevealer,
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public Multimap getAttributeModifiers(ItemStack stack)
|
||||
{
|
||||
Multimap multimap = super.getAttributeModifiers(stack);
|
||||
@@ -154,7 +155,8 @@ public class ItemArmorInfinity extends ItemArmor implements IGoggles, IRevealer,
|
||||
return 20;
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if(Compat.thaumic)
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + this.getVisDiscount(stack, player, (Aspect)null) + "%");
|
||||
if(Compat.botan) {
|
||||
@@ -180,4 +182,18 @@ public class ItemArmorInfinity extends ItemArmor implements IGoggles, IRevealer,
|
||||
tag.setBoolean("phantomInk", ink);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
super.registerIcons(ir);
|
||||
|
||||
this.cosmicMask = ir.registerIcon("avaritia:infinity_armor_" + slot + "_mask");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getMaskTexture(ItemStack stack) {
|
||||
return this.cosmicMask;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package fox.spiteful.avaritia.render;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Random;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.items.ItemArmorInfinity;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -44,6 +45,10 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
private Overlay overlay;
|
||||
private Overlay invulnOverlay;
|
||||
private boolean invulnRender = true;
|
||||
private boolean showHat;
|
||||
private boolean showChest;
|
||||
private boolean showLeg;
|
||||
private boolean showFoot;
|
||||
|
||||
private float expand;
|
||||
|
||||
@@ -202,21 +207,44 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
public void update(EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot) {
|
||||
this.currentSlot = armorSlot;
|
||||
|
||||
this.bipedHead.showModel = armorSlot == 0;
|
||||
this.bipedHeadwear.showModel = armorSlot == 0;
|
||||
this.bipedBody.showModel = armorSlot == 1 || armorSlot == 2;
|
||||
this.bipedRightArm.showModel = armorSlot == 1;
|
||||
this.bipedLeftArm.showModel = armorSlot == 1;
|
||||
this.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
this.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
this.invulnRender = false;
|
||||
|
||||
this.overlay.bipedHead.showModel = armorSlot == 0;
|
||||
this.overlay.bipedHeadwear.showModel = armorSlot == 0;
|
||||
this.overlay.bipedBody.showModel = armorSlot == 1 || armorSlot == 2;
|
||||
this.overlay.bipedRightArm.showModel = armorSlot == 1;
|
||||
this.overlay.bipedLeftArm.showModel = armorSlot == 1;
|
||||
this.overlay.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
this.overlay.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
ItemStack hat = entityLiving.getEquipmentInSlot(4);
|
||||
ItemStack chest = entityLiving.getEquipmentInSlot(3);
|
||||
ItemStack leg = entityLiving.getEquipmentInSlot(2);
|
||||
ItemStack foot = entityLiving.getEquipmentInSlot(1);
|
||||
|
||||
boolean hasHat = hat != null && hat.getItem() == LudicrousItems.infinity_helm && !((ItemArmorInfinity)(LudicrousItems.infinity_helm)).hasPhantomInk(hat);
|
||||
boolean hasChest = chest != null && chest.getItem() == LudicrousItems.infinity_armor && !((ItemArmorInfinity)(LudicrousItems.infinity_armor)).hasPhantomInk(chest);
|
||||
boolean hasLeg = leg != null && leg.getItem() == LudicrousItems.infinity_pants && !((ItemArmorInfinity)(LudicrousItems.infinity_pants)).hasPhantomInk(leg);
|
||||
boolean hasFoot = foot != null && foot.getItem() == LudicrousItems.infinity_shoes && !((ItemArmorInfinity)(LudicrousItems.infinity_shoes)).hasPhantomInk(foot);
|
||||
|
||||
if (armorSlot == 0) {
|
||||
if (hasHat && hasChest && hasLeg && hasFoot) {
|
||||
this.invulnRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.showHat = hasHat && armorSlot == 0;
|
||||
this.showChest = hasChest && armorSlot == 1;
|
||||
this.showLeg = hasLeg && armorSlot == 2;
|
||||
this.showFoot = hasFoot && armorSlot == 3;
|
||||
|
||||
this.bipedHead.showModel = showHat;
|
||||
this.bipedHeadwear.showModel = showHat;
|
||||
this.bipedBody.showModel = showChest || showLeg;
|
||||
this.bipedRightArm.showModel = showChest;
|
||||
this.bipedLeftArm.showModel = showChest;
|
||||
this.bipedRightLeg.showModel = showLeg || showFoot;
|
||||
this.bipedLeftLeg.showModel = showLeg || showFoot;
|
||||
|
||||
this.overlay.bipedHead.showModel = showHat;
|
||||
this.overlay.bipedHeadwear.showModel = showHat;
|
||||
this.overlay.bipedBody.showModel = showChest || showLeg;
|
||||
this.overlay.bipedRightArm.showModel = showChest;
|
||||
this.overlay.bipedLeftArm.showModel = showChest;
|
||||
this.overlay.bipedRightLeg.showModel = showLeg || showFoot;
|
||||
this.overlay.bipedLeftLeg.showModel = showLeg || showFoot;
|
||||
|
||||
this.bipedLeftWing.showModel = false;
|
||||
this.bipedRightWing.showModel = false;
|
||||
@@ -273,30 +301,13 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// set effect
|
||||
this.invulnRender = false;
|
||||
if (armorSlot == 0) {
|
||||
ItemStack hat = entityLiving.getEquipmentInSlot(4);
|
||||
ItemStack chest = entityLiving.getEquipmentInSlot(3);
|
||||
ItemStack leg = entityLiving.getEquipmentInSlot(2);
|
||||
ItemStack foot = entityLiving.getEquipmentInSlot(1);
|
||||
|
||||
boolean hasHat = hat != null && hat.getItem() == LudicrousItems.infinity_helm;
|
||||
boolean hasChest = chest != null && chest.getItem() == LudicrousItems.infinity_armor;
|
||||
boolean hasLeg = leg != null && leg.getItem() == LudicrousItems.infinity_pants;
|
||||
boolean hasFoot = foot != null && foot.getItem() == LudicrousItems.infinity_shoes;
|
||||
|
||||
if (hasHat && hasChest && hasLeg && hasFoot) {
|
||||
this.invulnRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity)
|
||||
public void setRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity);
|
||||
super.setRotationAngles(f1, f2, f3, f4, f5, f6, entity);
|
||||
|
||||
if (RenderManager.instance.entityRenderMap.containsKey(entity.getClass())) {
|
||||
Render r = (Render) RenderManager.instance.entityRenderMap.get(entity.getClass());
|
||||
@@ -304,8 +315,6 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
if (r instanceof RenderBiped) {
|
||||
ModelBiped m = ((RenderBiped) r).modelBipedMain;
|
||||
|
||||
//Lumberjack.info("Entity model: "+m);
|
||||
|
||||
copyBipedAngles(m, this);
|
||||
}
|
||||
}
|
||||
@@ -318,21 +327,21 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
this.bipedLeftArm.showModel = false;
|
||||
this.bipedRightLeg.showModel = false;
|
||||
this.bipedLeftLeg.showModel = false;
|
||||
this.bipedHeadwear.showModel = this.currentSlot == 0 ? true : false;
|
||||
this.bipedHeadwear.showModel = this.showHat ? true : false;
|
||||
}
|
||||
|
||||
public void setGems() {
|
||||
this.bipedHead.showModel = false;
|
||||
this.bipedHeadwear.showModel = false;
|
||||
this.bipedBody.showModel = this.legs ? false : (this.currentSlot == 1 ? true : false);
|
||||
this.bipedRightArm.showModel = this.legs ? false : (this.currentSlot == 1 ? true : false);
|
||||
this.bipedLeftArm.showModel = this.legs ? false : (this.currentSlot == 1 ? true : false);
|
||||
this.bipedRightLeg.showModel = this.legs ? (this.currentSlot == 2 ? true : false) : false;
|
||||
this.bipedLeftLeg.showModel = this.legs ? (this.currentSlot == 2 ? true : false) : false;
|
||||
this.bipedBody.showModel = this.legs ? false : (this.showChest ? true : false);
|
||||
this.bipedRightArm.showModel = this.legs ? false : (this.showChest ? true : false);
|
||||
this.bipedLeftArm.showModel = this.legs ? false : (this.showChest ? true : false);
|
||||
this.bipedRightLeg.showModel = this.legs ? (this.showLeg ? true : false) : false;
|
||||
this.bipedLeftLeg.showModel = this.legs ? (this.showLeg ? true : false) : false;
|
||||
}
|
||||
|
||||
public void setWings() {
|
||||
this.bipedBody.showModel = this.legs ? false : (this.currentSlot == 1 ? true : false);
|
||||
this.bipedBody.showModel = this.legs ? false : (this.showChest ? true : false);
|
||||
this.bipedLeftWing.showModel = true;
|
||||
this.bipedRightWing.showModel = true;
|
||||
this.bipedHeadwear.showModel = false;
|
||||
@@ -343,7 +352,7 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
this.bipedHeadwear.showModel = false;
|
||||
this.bipedHead.showModel = false;
|
||||
|
||||
this.overlay.bipedBody.showModel = this.legs ? false : (this.currentSlot == 1 ? true : false);
|
||||
this.overlay.bipedBody.showModel = this.legs ? false : (this.showChest ? true : false);
|
||||
this.overlay.bipedLeftWing.showModel = true;
|
||||
this.overlay.bipedRightWing.showModel = true;
|
||||
this.overlay.bipedHead.showModel = false;
|
||||
@@ -461,9 +470,9 @@ public class ModelArmorInfinity extends ModelBiped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity)
|
||||
public void setRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity);
|
||||
super.setRotationAngles(f1,f2,f3,f4,f5,f6, entity);
|
||||
|
||||
if (RenderManager.instance.entityRenderMap.containsKey(entity.getClass())) {
|
||||
Render r = (Render) RenderManager.instance.entityRenderMap.get(entity.getClass());
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class ShaderHelper {
|
||||
ARBShaderObjects.glCompileShaderARB(shader);
|
||||
|
||||
if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
|
||||
throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
|
||||
throw new RuntimeException("Error creating shader \""+filename+"\": " + getLogInfo(shader));
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user