Anti-comments sweep!
This commit is contained in:
parent
e6a10f3f06
commit
dea1f87078
454 changed files with 23594 additions and 26739 deletions
|
@ -1,11 +1,5 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
@ -13,46 +7,51 @@ import cpw.mods.fml.common.eventhandler.Event.Result;
|
|||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ClientEventHandler
|
||||
public class ClientEventHandler
|
||||
{
|
||||
private Minecraft mcClient = FMLClientHandler.instance().getClient();
|
||||
private Minecraft mcClient = FMLClientHandler.instance().getClient();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerSoundEvent(SoundEvent event)
|
||||
{
|
||||
if(Minecraft.getMinecraft() != null)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if(player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
}
|
||||
if (Minecraft.getMinecraft() != null)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(RenderTickEvent event)
|
||||
{
|
||||
if (event.phase.equals(Phase.START))
|
||||
return;
|
||||
|
||||
|
||||
if (!RenderHelper.onTickInGame(mcClient))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event)
|
||||
{
|
||||
GL11.glDisable(2929);
|
||||
GL11.glDisable(2929);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event)
|
||||
{
|
||||
GL11.glEnable(2929);
|
||||
GL11.glEnable(2929);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,89 +1,29 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.CommonProxy;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityLowerGuardian;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShade;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.*;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderConduit;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderCrystalBelljar;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderPedestal;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderPlinth;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderReagentConduit;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEffectBlock;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEnhancementBlock;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellModifierBlock;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellParadigmBlock;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.RenderWritingTable;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.ShaderHelper;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.TEAltarRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAlchemicalCalcinatorItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAltarItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEBellJarItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEConduitItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellEffectBlockItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellEnhancementBlockItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellModifierBlockItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellParadigmBlockItemRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBileDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBoulderFist;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderElemental;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderFallenAngel;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderIceDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderLowerGuardian;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderShade;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderSmallEarthGolem;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderWingedFireDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBileDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBoulderFist;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelElemental;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelFallenAngel;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelIceDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelLowerGuardian;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelShade;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelSmallEarthGolem;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.*;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.*;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.mob.*;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.*;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.*;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
|
@ -93,39 +33,24 @@ public class ClientProxy extends CommonProxy
|
|||
@Override
|
||||
public void registerRenderers()
|
||||
{
|
||||
//altarRenderType = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityParticleBeam.class, new RenderEnergyBlastProjectile());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor());
|
||||
//EntityRegistry.registerGlobalEntityID(EntityFallenAngel.class, "AlchemicalWizardry.FallenAngel", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityLowerGuardian.class, "AlchemicalWizardry.LowerGuardian", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityBileDemon.class, "AlchemicalWizardry.BileDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityWingedFireDemon.class, "AlchemicalWizardry.WingedFireDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntitySmallEarthGolem.class, "AlchemicalWizardry.SmallEarthGolem", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityIceDemon.class, "AlchemicalWizardry.IceDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F));
|
||||
// EntityRegistry.registerGlobalEntityID(EntityBoulderFist.class, "AlchemicalWizardry.BoulderFist", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityShade.class, "AlchemicalWizardry.Shade", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityShade.class, new RenderShade(new ModelShade(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityAirElemental.class, "AlchemicalWizardry.AirElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityWaterElemental.class, "AlchemicalWizardry.WaterElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityEarthElemental.class, "AlchemicalWizardry.EarthElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityFireElemental.class, "AlchemicalWizardry.FireElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityShadeElemental.class, "AlchemicalWizardry.ShadeElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
//EntityRegistry.registerGlobalEntityID(EntityHolyElemental.class, "AlchemicalWizardry.HolyElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());
|
||||
|
@ -149,11 +74,7 @@ public class ClientProxy extends CommonProxy
|
|||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer());
|
||||
|
||||
//RenderingRegistry.registerEntityRenderingHandler(FireProjectile.class, new RenderFireProjectile());
|
||||
//RenderingRegistry.registerBlockHandler(new AltarRenderer());
|
||||
|
||||
ShaderHelper.initShaders();
|
||||
ShaderHelper.initShaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,14 +86,12 @@ public class ClientProxy extends CommonProxy
|
|||
@Override
|
||||
public void InitRendering()
|
||||
{
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer());
|
||||
//MinecraftForgeClient.registerItemRenderer(AlchemicalWizardry.blockWritingTable.blockID, new TEWritingTableItemRenderer());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerEvents()
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(new ClientEventHandler());
|
||||
FMLCommonHandler.instance().bus().register(new ClientEventHandler());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is a utility class that was created by bspkrs.
|
||||
* https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/ColorThreshold.java
|
||||
*/
|
||||
public class ColourThreshold implements Comparable<ColourThreshold>
|
||||
{
|
||||
public int threshold;
|
||||
public int threshold;
|
||||
public String colorCode;
|
||||
|
||||
public ColourThreshold(int t, String c)
|
||||
|
|
|
@ -1,38 +1,36 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
|
||||
|
||||
public class HUDElement
|
||||
{
|
||||
public final ItemStack itemStack;
|
||||
public final int iconW;
|
||||
public final int iconH;
|
||||
public final int padW;
|
||||
public final int iconW;
|
||||
public final int iconH;
|
||||
public final int padW;
|
||||
public final int value;
|
||||
private int elementW;
|
||||
private int elementH;
|
||||
private String itemName = "";
|
||||
private int itemNameW;
|
||||
private String itemDamage = "";
|
||||
private int itemDamageW;
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private int elementW;
|
||||
private int elementH;
|
||||
private String itemName = "";
|
||||
private int itemNameW;
|
||||
private String itemDamage = "";
|
||||
private int itemDamageW;
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static final int offset = 5;
|
||||
|
||||
|
||||
public boolean enableItemName = false;
|
||||
public boolean showValue = true;
|
||||
public boolean showDamageOverlay = false;
|
||||
public boolean showItemCount = false;
|
||||
|
||||
static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
|
||||
static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
|
@ -40,48 +38,47 @@ public class HUDElement
|
|||
this.iconH = iconH;
|
||||
this.padW = padW;
|
||||
this.value = value;
|
||||
|
||||
|
||||
initSize();
|
||||
}
|
||||
|
||||
|
||||
public int width()
|
||||
{
|
||||
return elementW;
|
||||
}
|
||||
|
||||
|
||||
public int height()
|
||||
{
|
||||
return elementH;
|
||||
}
|
||||
|
||||
|
||||
private void initSize()
|
||||
{
|
||||
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) :
|
||||
Math.max(mc.fontRenderer.FONT_HEIGHT, iconH);
|
||||
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
int damage = 1;
|
||||
int maxDamage = 1;
|
||||
|
||||
|
||||
if (showValue)
|
||||
{
|
||||
maxDamage = itemStack.getMaxDamage() + 1;
|
||||
damage = maxDamage - itemStack.getItemDamageForDisplay();
|
||||
|
||||
|
||||
boolean showSpecialValue = true;
|
||||
boolean showValue = false;
|
||||
boolean showPercent = false;
|
||||
|
||||
|
||||
boolean showMaxDamage = true;
|
||||
boolean thresholdPercent = true;
|
||||
|
||||
if(showSpecialValue)
|
||||
|
||||
if (showSpecialValue)
|
||||
{
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage)) + this.value;
|
||||
}
|
||||
else if (showValue)
|
||||
} else if (showValue)
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage)) + damage +
|
||||
(showMaxDamage ? "/" + maxDamage : "");
|
||||
|
@ -90,21 +87,21 @@ public class HUDElement
|
|||
(thresholdPercent ? damage * 100 / maxDamage : damage)) +
|
||||
(damage * 100 / maxDamage) + "%";
|
||||
}
|
||||
|
||||
|
||||
itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage));
|
||||
elementW = padW + iconW + padW + itemDamageW + offset;
|
||||
|
||||
|
||||
if (enableItemName)
|
||||
{
|
||||
itemName = itemStack.getDisplayName();
|
||||
elementW = padW + iconW + padW +
|
||||
Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW);
|
||||
}
|
||||
|
||||
|
||||
itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void renderToHud(int x, int y)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
@ -112,31 +109,30 @@ public class HUDElement
|
|||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.zLevel = 200.0F;
|
||||
|
||||
|
||||
//if (ArmorStatusHUD.alignMode.toLowerCase().contains("right"))
|
||||
boolean toRight = true;
|
||||
if(toRight)
|
||||
if (toRight)
|
||||
{
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount);
|
||||
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount);
|
||||
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x + iconW + padW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
|
@ -18,113 +17,113 @@ import org.lwjgl.opengl.GL11;
|
|||
*/
|
||||
public final class HUDUtils
|
||||
{
|
||||
private static int[] colorCodes = new int[] { 0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215,
|
||||
0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 };
|
||||
|
||||
private static int[] colorCodes = new int[]{0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215,
|
||||
0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959};
|
||||
|
||||
public static int getColorCode(char c, boolean isLighter)
|
||||
{
|
||||
return colorCodes[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
*
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
*
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
drawContinuousTexturedBox(res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
*
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(res);
|
||||
drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
*
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
int fillerWidth = textureWidth - leftBorder - rightBorder;
|
||||
int fillerHeight = textureHeight - topBorder - bottomBorder;
|
||||
int canvasWidth = width - leftBorder - rightBorder;
|
||||
|
@ -133,7 +132,7 @@ public final class HUDUtils
|
|||
int remainderWidth = canvasWidth % fillerWidth;
|
||||
int yPasses = canvasHeight / fillerHeight;
|
||||
int remainderHeight = canvasHeight % fillerHeight;
|
||||
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
|
@ -143,19 +142,19 @@ public final class HUDUtils
|
|||
drawTexturedModalRect(x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel);
|
||||
// Bottom Right
|
||||
drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel);
|
||||
|
||||
|
||||
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++)
|
||||
{
|
||||
// Top Border
|
||||
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel);
|
||||
// Bottom Border
|
||||
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel);
|
||||
|
||||
|
||||
// Throw in some filler for good measure
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
|
||||
|
||||
// Side Borders
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
{
|
||||
|
@ -165,7 +164,7 @@ public final class HUDUtils
|
|||
drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
{
|
||||
float var7 = 0.00390625F;
|
||||
|
@ -178,7 +177,7 @@ public final class HUDUtils
|
|||
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position.
|
||||
*/
|
||||
|
@ -186,7 +185,7 @@ public final class HUDUtils
|
|||
{
|
||||
renderItemOverlayIntoGUI(fontRenderer, itemStack, x, y, true, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position.
|
||||
*/
|
||||
|
@ -212,16 +211,16 @@ public final class HUDUtils
|
|||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if (showCount)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
|
||||
if (itemStack.getMaxStackSize() > 1)
|
||||
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, itemStack.getItem(), itemStack.getItemDamage());
|
||||
else if (itemStack.getItem().equals(Items.bow))
|
||||
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, Items.arrow);
|
||||
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
String var6 = "" + count;
|
||||
|
@ -234,7 +233,7 @@ public final class HUDUtils
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args: tessellator, x, y, width,
|
||||
* height, color
|
||||
|
@ -249,12 +248,12 @@ public final class HUDUtils
|
|||
tessellator.addVertex((x + width), (y + 0), 0.0D);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
public static int countInInventory(EntityPlayer player, Item item)
|
||||
{
|
||||
return countInInventory(player, item, -1);
|
||||
}
|
||||
|
||||
|
||||
public static int countInInventory(EntityPlayer player, Item item, int md)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -263,7 +262,7 @@ public final class HUDUtils
|
|||
count += player.inventory.mainInventory[i].stackSize;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public static String stripCtrl(String s)
|
||||
{
|
||||
return s.replaceAll("(?i)\247[0-9a-fklmnor]", "");
|
||||
|
|
|
@ -1,121 +1,117 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RenderHelper
|
||||
public class RenderHelper
|
||||
{
|
||||
public static boolean showEquippedItem = true;
|
||||
public static boolean enableItemName = false;
|
||||
public static boolean enabled = true;
|
||||
public static boolean showInChat = true;
|
||||
|
||||
private static int xOffsetDefault = +50;
|
||||
public static int xOffset = xOffsetDefault;
|
||||
private static int yOffsetDefault = 2;
|
||||
public static int yOffset = yOffsetDefault;
|
||||
private static int yOffsetBottomCenterDefault = 41;
|
||||
public static int yOffsetBottomCenter = yOffsetBottomCenterDefault;
|
||||
private static boolean applyXOffsetToCenterDefault = true;
|
||||
public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault;
|
||||
private static boolean applyYOffsetToMiddleDefault = false;
|
||||
public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault;
|
||||
|
||||
public static String listMode = "horizontal";
|
||||
public static String alignMode = "bottomcenter";
|
||||
|
||||
private static ScaledResolution scaledResolution;
|
||||
|
||||
public static boolean showEquippedItem = true;
|
||||
public static boolean enableItemName = false;
|
||||
public static boolean enabled = true;
|
||||
public static boolean showInChat = true;
|
||||
|
||||
private static int xOffsetDefault = +50;
|
||||
public static int xOffset = xOffsetDefault;
|
||||
private static int yOffsetDefault = 2;
|
||||
public static int yOffset = yOffsetDefault;
|
||||
private static int yOffsetBottomCenterDefault = 41;
|
||||
public static int yOffsetBottomCenter = yOffsetBottomCenterDefault;
|
||||
private static boolean applyXOffsetToCenterDefault = true;
|
||||
public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault;
|
||||
private static boolean applyYOffsetToMiddleDefault = false;
|
||||
public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault;
|
||||
|
||||
public static String listMode = "horizontal";
|
||||
public static String alignMode = "bottomcenter";
|
||||
|
||||
private static ScaledResolution scaledResolution;
|
||||
|
||||
public static boolean onTickInGame(Minecraft mc)
|
||||
{
|
||||
if (enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat && showInChat))
|
||||
&& !mc.gameSettings.showDebugInfo)
|
||||
{
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
World world = mc.theWorld;
|
||||
if(SpellHelper.canPlayerSeeAlchemy(player))
|
||||
{
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
World world = mc.theWorld;
|
||||
if (SpellHelper.canPlayerSeeAlchemy(player))
|
||||
{
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
displayArmorStatus(mc);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static List<HUDElement> getHUDElements(Minecraft mc)
|
||||
|
||||
private static List<HUDElement> getHUDElements(Minecraft mc)
|
||||
{
|
||||
List<HUDElement> elements = new ArrayList();
|
||||
|
||||
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
|
||||
World world = mc.theWorld;
|
||||
List<HUDElement> elements = new ArrayList();
|
||||
|
||||
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
|
||||
World world = mc.theWorld;
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return elements;
|
||||
return elements;
|
||||
} else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(tile instanceof IReagentHandler))
|
||||
|
||||
if (!(tile instanceof IReagentHandler))
|
||||
{
|
||||
return elements;
|
||||
return elements;
|
||||
}
|
||||
|
||||
IReagentHandler relay = (IReagentHandler)tile;
|
||||
|
||||
|
||||
IReagentHandler relay = (IReagentHandler) tile;
|
||||
|
||||
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
|
||||
|
||||
if(infos != null)
|
||||
|
||||
if (infos != null)
|
||||
{
|
||||
for(ReagentContainerInfo info : infos)
|
||||
{
|
||||
if(info == null || info.reagent == null || info.reagent.reagent == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
|
||||
|
||||
for (ReagentContainerInfo info : infos)
|
||||
{
|
||||
if (info == null || info.reagent == null || info.reagent.reagent == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
|
||||
|
||||
if (itemStack != null)
|
||||
elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
private static int getX(int width)
|
||||
private static int getX(int width)
|
||||
{
|
||||
if (alignMode.toLowerCase().contains("center"))
|
||||
return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0);
|
||||
|
@ -124,7 +120,7 @@ public class RenderHelper
|
|||
else
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
|
||||
private static int getY(int rowCount, int height)
|
||||
{
|
||||
if (alignMode.toLowerCase().contains("middle"))
|
||||
|
@ -136,49 +132,48 @@ public class RenderHelper
|
|||
else
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
private static int getElementsWidth(List<HUDElement> elements)
|
||||
|
||||
private static int getElementsWidth(List<HUDElement> elements)
|
||||
{
|
||||
int r = 0;
|
||||
for (HUDElement he : elements)
|
||||
r += he.width();
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
private static void displayArmorStatus(Minecraft mc)
|
||||
{
|
||||
List<HUDElement> elements = getHUDElements(mc);
|
||||
|
||||
|
||||
if (elements.size() > 0)
|
||||
{
|
||||
int yOffset = enableItemName ? 18 : 16;
|
||||
|
||||
|
||||
if (listMode.equalsIgnoreCase("vertical"))
|
||||
{
|
||||
int yBase = getY(elements.size(), yOffset);
|
||||
|
||||
|
||||
for (HUDElement e : elements)
|
||||
{
|
||||
e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase);
|
||||
yBase += yOffset;
|
||||
}
|
||||
}
|
||||
else if (listMode.equalsIgnoreCase("horizontal"))
|
||||
} else if (listMode.equalsIgnoreCase("horizontal"))
|
||||
{
|
||||
int totalWidth = getElementsWidth(elements);
|
||||
int yBase = getY(1, yOffset);
|
||||
int xBase = getX(totalWidth);
|
||||
int prevX = 0;
|
||||
|
||||
|
||||
for (HUDElement e : elements)
|
||||
{
|
||||
e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase);
|
||||
prevX += (e.width());
|
||||
}
|
||||
}else if(listMode.equalsIgnoreCase("compound"))
|
||||
} else if (listMode.equalsIgnoreCase("compound"))
|
||||
{
|
||||
//TODO
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue