Initial commit of BM 1.8

This commit is contained in:
WayofTime 2015-07-29 08:23:01 -04:00
parent d99eadbea7
commit c5681dc831
713 changed files with 6502 additions and 27334 deletions

View file

@ -1,55 +1,23 @@
package WayofTime.alchemicalWizardry.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.event.sound.SoundEvent;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ClientEventHandler
{
private Minecraft mc = FMLClientHandler.instance().getClient();
public static ResourceLocation currentPlayerTexture = null;
private Minecraft mcClient = FMLClientHandler.instance().getClient();
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderPOVArmour(RenderHandEvent event)
{
if (this.mc.thePlayer.worldObj.isRemote && this.mc.gameSettings.thirdPersonView == 0 && !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI && !this.mc.playerController.enableEverythingIsScrewedUpMode())
{
currentPlayerTexture = ((AbstractClientPlayer) mc.thePlayer).getLocationSkin();
ClientUtils.renderPlayerArmourInPOV(mc.thePlayer, event.partialTicks);
event.setCanceled(true);
}
}
// @SubscribeEvent(priority = EventPriority.LOWEST)
// public void onPlayerRenderTick(RenderPlayerEvent.Pre event)
// {
// ModelBiped model = ((BoundArmour)ModItems.boundPlate).getArmorModel(event.entityPlayer, new ItemStack(ModItems.boundPlate), 2);
// String texture = ((BoundArmour)ModItems.boundPlate).getArmorTexture(new ItemStack(ModItems.boundPlate), event.entityPlayer, 2, "");
//
// ResourceLocation resourcelocation = new ResourceLocation(texture);
// event.renderer.modelBipedMain.bipedBody.addChild(model.bipedBody);
// Minecraft.getMinecraft().renderEngine.bindTexture(resourcelocation);
//
// }
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
@ -98,7 +66,7 @@ public class ClientEventHandler
if (event.phase.equals(Phase.START))
return;
if (!RenderHelper.onTickInGame(mc))
// if (!RenderHelper.onTickInGame(mcClient))
{
}

View file

@ -1,10 +1,10 @@
package WayofTime.alchemicalWizardry.client;
import WayofTime.alchemicalWizardry.common.thread.GAPIChecker;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.client.renderer.RitualDivinerRender;
@ -50,6 +50,7 @@ import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEnhancement
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;
@ -84,7 +85,6 @@ import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
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.thread.GAPIChecker;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
@ -159,10 +159,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TESpellParadigmBlock.class, new RenderSpellParadigmBlock());
ClientRegistry.bindTileEntitySpecialRenderer(TESpellModifierBlock.class, new RenderSpellModifierBlock());
ClientRegistry.bindTileEntitySpecialRenderer(TEReagentConduit.class, new RenderReagentConduit());
if (AlchemicalWizardry.displayRitualAnimation)
{
ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone());
}
ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone());
ClientRegistry.bindTileEntitySpecialRenderer(TEAlchemicCalcinator.class, new RenderAlchemicCalcinator());
ClientRegistry.bindTileEntitySpecialRenderer(TEBellJar.class, new RenderCrystalBelljar());
@ -174,6 +171,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());
ShaderHelper.initShaders();
}
@Override

View file

@ -1,348 +0,0 @@
package WayofTime.alchemicalWizardry.client;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.FIRST_PERSON_MAP;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemCloth;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class ClientUtils
{
public static Minecraft mc = Minecraft.getMinecraft();
private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png");
public static void renderPlayerArmourInPOV(EntityPlayer player, float partialTickTime)
{
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
float f1 = 1.0f;//this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTickTime;
EntityClientPlayerMP entityclientplayermp = mc.thePlayer;
float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTickTime;
// GL11.glPushMatrix();
GL11.glRotatef(180 - (entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTickTime), 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
// GL11.glPopMatrix();
EntityPlayerSP entityplayersp = (EntityPlayerSP)entityclientplayermp;
float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTickTime;
float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTickTime;
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
ItemStack itemstack = player.getCurrentEquippedItem();
if (itemstack != null && itemstack.getItem() instanceof ItemCloth)
{
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
}
int i = mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f5;
float f6;
float f7;
if (itemstack != null)
{
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f5 = (float)(l >> 16 & 255) / 255.0F;
f6 = (float)(l >> 8 & 255) / 255.0F;
f7 = (float)(l & 255) / 255.0F;
GL11.glColor4f(f5, f6, f7, 1.0F);
}
else
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
float f8;
float f9;
float f10;
float f13;
Render render;
RenderPlayer renderplayer;
if (itemstack != null && itemstack.getItem() instanceof ItemMap)
{
GL11.glPushMatrix();
f13 = 0.8F;
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * (float)Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
f5 = 1.0F - f2 / 45.0F + 0.1F;
if (f5 < 0.0F)
{
f5 = 0.0F;
}
if (f5 > 1.0F)
{
f5 = 1.0F;
}
f5 = -MathHelper.cos(f5 * (float)Math.PI) * 0.5F + 0.5F;
GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
for (int i1 = 0; i1 < 2; ++i1)
{
int j1 = i1 * 2 - 1;
GL11.glPushMatrix();
GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)j1);
GL11.glRotatef((float)(-45 * j1), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef((float)(-65 * j1), 0.0F, 1.0F, 0.0F);
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
renderplayer = (RenderPlayer)render;
f10 = 1.0F;
GL11.glScalef(f10, f10, f10);
renderFirstPersonArm(renderplayer, mc.thePlayer);
GL11.glPopMatrix();
}
f6 = entityclientplayermp.getSwingProgress(partialTickTime);
f7 = MathHelper.sin(f6 * f6 * (float)Math.PI);
f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI);
GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
f9 = 0.38F;
GL11.glScalef(f9, f9, f9);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
f10 = 0.015625F;
GL11.glScalef(f10, f10, f10);
mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
Tessellator tessellator = Tessellator.instance;
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
tessellator.startDrawingQuads();
byte b0 = 7;
tessellator.addVertexWithUV((double)(0 - b0), (double)(128 + b0), 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double)(128 + b0), (double)(128 + b0), 0.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, mc.theWorld);
if (custom == null)
{
if (mapdata != null)
{
mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false);
}
}
else
{
custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata);
}
GL11.glPopMatrix();
}
else if (itemstack != null)
{
GL11.glPushMatrix();
f13 = 0.8F;
if (entityclientplayermp.getItemInUseCount() > 0)
{
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.eat || enumaction == EnumAction.drink)
{
f6 = (float)entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F;
f7 = 1.0F - f6 / (float)itemstack.getMaxItemUseDuration();
f8 = 1.0F - f7;
f8 = f8 * f8 * f8;
f8 = f8 * f8 * f8;
f8 = f8 * f8 * f8;
f9 = 1.0F - f8;
GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float)Math.PI) * 0.1F) * (float)((double)f7 > 0.2D ? 1 : 0), 0.0F);
GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F);
GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
}
}
else
{
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * (float)Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F);
}
GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * f5 * (float)Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F);
f8 = 0.4F;
GL11.glScalef(f8, f8, f8);
float f11;
float f12;
if (entityclientplayermp.getItemInUseCount() > 0)
{
EnumAction enumaction1 = itemstack.getItemUseAction();
if (enumaction1 == EnumAction.block)
{
GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
}
else if (enumaction1 == EnumAction.bow)
{
GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
f10 = (float)itemstack.getMaxItemUseDuration() - ((float)entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F);
f11 = f10 / 20.0F;
f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;
if (f11 > 1.0F)
{
f11 = 1.0F;
}
if (f11 > 0.1F)
{
GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F);
}
GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F);
GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
f12 = 1.0F + f11 * 0.2F;
GL11.glScalef(1.0F, 1.0F, f12);
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
}
}
if (itemstack.getItem().shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
if (itemstack.getItem().requiresMultipleRenderPasses())
{
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
{
int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x);
f10 = (float)(k1 >> 16 & 255) / 255.0F;
f11 = (float)(k1 >> 8 & 255) / 255.0F;
f12 = (float)(k1 & 255) / 255.0F;
GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON);
}
}
else
{
RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
}
GL11.glPopMatrix();
}
else if (!entityclientplayermp.isInvisible())
{
GL11.glPushMatrix();
f13 = 0.8F;
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * (float)Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
GL11.glTranslatef(-f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.4F, -f6 * 0.4F);
GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
f6 = MathHelper.sin(f5 * f5 * (float)Math.PI);
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI);
GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F);
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef(5.6F, 0.0F, 0.0F);
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
renderplayer = (RenderPlayer)render;
f10 = 1.0F;
GL11.glScalef(f10, f10, f10);
renderFirstPersonArm(renderplayer, mc.thePlayer);
GL11.glPopMatrix();
}
if (itemstack != null && itemstack.getItem() instanceof ItemCloth)
{
GL11.glDisable(GL11.GL_BLEND);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
}
public static void renderFirstPersonArm(RenderPlayer renderer, EntityPlayer player)
{
float f = 1.0F;
GL11.glColor3f(f, f, f);
GL11.glPushMatrix();
ModelRenderer mRenderer = new POVArmourModelWrapper(renderer.modelBipedMain);
renderer.modelBipedMain.onGround = 0.0F;
renderer.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player);
renderer.modelBipedMain.bipedRightArm.render(0.0625F);
GL11.glPushMatrix();
mRenderer.rotateAngleX = renderer.modelBipedMain.bipedRightArm.rotateAngleX;
mRenderer.rotateAngleY = renderer.modelBipedMain.bipedRightArm.rotateAngleY;
mRenderer.rotateAngleZ = renderer.modelBipedMain.bipedRightArm.rotateAngleZ;
mRenderer.render(0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}

View file

@ -1,6 +1,5 @@
package WayofTime.alchemicalWizardry.client;
import net.minecraft.client.settings.KeyBinding;
public class KeyBindings
{

View file

@ -1,47 +0,0 @@
package WayofTime.alchemicalWizardry.client;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class POVArmourModelWrapper extends ModelRenderer
{
private final ModelRenderer armModel;
private final ResourceLocation resource;
public POVArmourModelWrapper(ModelBase model)
{
super(model);
ItemStack plateStack = new ItemStack(ModItems.boundPlateFire);
ModelBiped bipedModel = ((BoundArmour)ModItems.boundPlateFire).getArmorModel(Minecraft.getMinecraft().thePlayer, plateStack, 1);
armModel = bipedModel.bipedRightArm;
resource = new ResourceLocation(((BoundArmour)ModItems.boundPlateFire).getArmorTexture(plateStack, Minecraft.getMinecraft().thePlayer, 1, "POV"));
addBox(0, 0, 0, 0, 0, 0); //Adds in a blank box as it's required in certain cases such as rendering arrows in entities
}
@Override
public void render(float partialTicks)
{
GL11.glPushMatrix();
// GL11.glTranslated(0.3, -.1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(resource);
armModel.rotateAngleX = this.rotateAngleX;
armModel.rotateAngleY = this.rotateAngleY;
armModel.rotateAngleZ = this.rotateAngleZ;
armModel.render(partialTicks);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ClientEventHandler.currentPlayerTexture);
}
}

View file

@ -1,15 +1,15 @@
package WayofTime.alchemicalWizardry.client.gui;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import static WayofTime.alchemicalWizardry.BloodMagicConfiguration.config;
import java.util.ArrayList;
import java.util.List;
import static WayofTime.alchemicalWizardry.BloodMagicConfiguration.config;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;
public class ConfigGui extends GuiConfig {
@ -22,16 +22,16 @@ public class ConfigGui extends GuiConfig {
List<IConfigElement> list = new ArrayList<IConfigElement>();
// adds sections declared in ConfigHandler. toLowerCase() is used because the configuration class automatically does this, so must we.
list.add(new ConfigElement<ConfigCategory>(config.getCategory("clientsettings".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("dungeon loot chances".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("meteor".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("orecrushing".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("potion id".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("wellofsufferingblacklist".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("wimpysettings".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("ritual blacklist".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("teleposer blacklist".toLowerCase())));
list.add(new ConfigElement<ConfigCategory>(config.getCategory("demon configs".toLowerCase())));
list.add(new ConfigElement(config.getCategory("clientsettings".toLowerCase())));
list.add(new ConfigElement(config.getCategory("dungeon loot chances".toLowerCase())));
list.add(new ConfigElement(config.getCategory("meteor".toLowerCase())));
list.add(new ConfigElement(config.getCategory("orecrushing".toLowerCase())));
list.add(new ConfigElement(config.getCategory("potion id".toLowerCase())));
list.add(new ConfigElement(config.getCategory("wellofsufferingblacklist".toLowerCase())));
list.add(new ConfigElement(config.getCategory("wimpysettings".toLowerCase())));
list.add(new ConfigElement(config.getCategory("ritual blacklist".toLowerCase())));
list.add(new ConfigElement(config.getCategory("teleposer blacklist".toLowerCase())));
list.add(new ConfigElement(config.getCategory("demon configs".toLowerCase())));
return list;
}

View file

@ -1,178 +1,178 @@
package WayofTime.alchemicalWizardry.client.nei;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
import codechicken.nei.ItemList;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
/**
* NEI Alchemy Recipe Handler by joshie *
*/
public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
public class CachedAlchemyRecipe extends CachedRecipe {
public class BloodOrbs {
public PositionedStack stack;
public BloodOrbs(ItemStack orb) {
this.stack = new PositionedStack(orb, 136, 47, false);
}
}
ArrayList<BloodOrbs> orbs;
PositionedStack output;
List<PositionedStack> inputs;
int lp;
public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
this(recipe);
this.orbs = new ArrayList<BloodOrbs>();
orbs.add(new BloodOrbs(orb));
}
public CachedAlchemyRecipe(AlchemyRecipe recipe) {
List<PositionedStack> inputs = new ArrayList<PositionedStack>();
ItemStack[] stacks = recipe.getRecipe();
if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
if (stacks.length > 2) inputs.add(new PositionedStack(stacks[2], 101, 19));
if (stacks.length > 3) inputs.add(new PositionedStack(stacks[3], 64, 47));
if (stacks.length > 4) inputs.add(new PositionedStack(stacks[4], 88, 47));
this.inputs = inputs;
this.output = new PositionedStack(recipe.getResult(), 76, 25);
this.lp = recipe.getAmountNeeded() * 100;
this.orbs = new ArrayList<BloodOrbs>();
for (Item orb : bloodOrbs) {
if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
orbs.add(new BloodOrbs(new ItemStack(orb)));
}
}
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getOtherStack() {
if (orbs == null || orbs.size() <= 0) return null;
return orbs.get((cycleticks / 48) % orbs.size()).stack;
}
}
@Override
public TemplateRecipeHandler newInstance() {
for (ItemStack item : ItemList.items) {
if (item != null && item.getItem() instanceof IBloodOrb) {
bloodOrbs.add(item.getItem());
}
}
return super.newInstance();
}
@Override
public String getOverlayIdentifier() {
return "alchemicalwizardry.alchemy";
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(134, 22, 16, 24), "alchemicalwizardry.alchemy"));
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiWritingTable.class;
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("alchemicalwizardry.alchemy") && getClass() == NEIAlchemyRecipeHandler.class) {
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
if (recipe.getResult() != null) arecipes.add(new CachedAlchemyRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
if (recipe == null) continue;
if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
arecipes.add(new CachedAlchemyRecipe(recipe));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (ingredient.getItem() instanceof IBloodOrb) {
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
if (recipe == null) continue;
if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
}
}
} else {
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
if (recipe == null) continue;
ItemStack[] stacks = recipe.getRecipe();
for (ItemStack stack : stacks) {
if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
arecipes.add(new CachedAlchemyRecipe(recipe));
break;
}
}
}
}
}
@Override
public void drawExtras(int id) {
CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
}
public int getLPX(int lp) {
if (lp < 10) return 122;
else if (lp < 100) return 122;
else if (lp < 1000) return 130;
else if (lp < 10000) return 127;
else if (lp < 100000) return 124;
return 122;
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("tile.blockWritingTable.name");
}
@Override
public String getGuiTexture() {
return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
}
}
//package WayofTime.alchemicalWizardry.client.nei;
//
//import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
//
//import java.awt.Rectangle;
//import java.util.ArrayList;
//import java.util.List;
//
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.inventory.GuiContainer;
//import net.minecraft.item.Item;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.ResourceLocation;
//import net.minecraft.util.StatCollector;
//import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
//import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
//import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
//import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
//import codechicken.nei.ItemList;
//import codechicken.nei.NEIServerUtils;
//import codechicken.nei.PositionedStack;
//import codechicken.nei.recipe.TemplateRecipeHandler;
//
///**
// * NEI Alchemy Recipe Handler by joshie *
// */
//public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
// public class CachedAlchemyRecipe extends CachedRecipe {
// public class BloodOrbs {
// public PositionedStack stack;
//
// public BloodOrbs(ItemStack orb) {
// this.stack = new PositionedStack(orb, 136, 47, false);
// }
// }
//
// ArrayList<BloodOrbs> orbs;
// PositionedStack output;
// List<PositionedStack> inputs;
// int lp;
//
// public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
// this(recipe);
// this.orbs = new ArrayList<BloodOrbs>();
// orbs.add(new BloodOrbs(orb));
// }
//
// public CachedAlchemyRecipe(AlchemyRecipe recipe) {
// List<PositionedStack> inputs = new ArrayList<PositionedStack>();
// ItemStack[] stacks = recipe.getRecipe();
// if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
// if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
// if (stacks.length > 2) inputs.add(new PositionedStack(stacks[2], 101, 19));
// if (stacks.length > 3) inputs.add(new PositionedStack(stacks[3], 64, 47));
// if (stacks.length > 4) inputs.add(new PositionedStack(stacks[4], 88, 47));
// this.inputs = inputs;
// this.output = new PositionedStack(recipe.getResult(), 76, 25);
// this.lp = recipe.getAmountNeeded() * 100;
// this.orbs = new ArrayList<BloodOrbs>();
// for (Item orb : bloodOrbs) {
// if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
// orbs.add(new BloodOrbs(new ItemStack(orb)));
// }
// }
// }
//
// @Override
// public List<PositionedStack> getIngredients() {
// return inputs;
// }
//
// @Override
// public PositionedStack getResult() {
// return output;
// }
//
// @Override
// public PositionedStack getOtherStack() {
// if (orbs == null || orbs.size() <= 0) return null;
// return orbs.get((cycleticks / 48) % orbs.size()).stack;
// }
// }
//
// @Override
// public TemplateRecipeHandler newInstance() {
// for (ItemStack item : ItemList.items) {
// if (item != null && item.getItem() instanceof IBloodOrb) {
// bloodOrbs.add(item.getItem());
// }
// }
//
// return super.newInstance();
// }
//
// @Override
// public String getOverlayIdentifier() {
// return "alchemicalwizardry.alchemy";
// }
//
// @Override
// public void loadTransferRects() {
// transferRects.add(new RecipeTransferRect(new Rectangle(134, 22, 16, 24), "alchemicalwizardry.alchemy"));
// }
//
// @Override
// public Class<? extends GuiContainer> getGuiClass() {
// return GuiWritingTable.class;
// }
//
// @Override
// public void loadCraftingRecipes(String outputId, Object... results) {
// if (outputId.equals("alchemicalwizardry.alchemy") && getClass() == NEIAlchemyRecipeHandler.class) {
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
// if (recipe.getResult() != null) arecipes.add(new CachedAlchemyRecipe(recipe));
// }
// } else {
// super.loadCraftingRecipes(outputId, results);
// }
// }
//
// @Override
// public void loadCraftingRecipes(ItemStack result) {
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
// if (recipe == null) continue;
// if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
// arecipes.add(new CachedAlchemyRecipe(recipe));
// }
// }
// }
//
// @Override
// public void loadUsageRecipes(ItemStack ingredient) {
// if (ingredient.getItem() instanceof IBloodOrb) {
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
// if (recipe == null) continue;
// if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
// arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
// }
// }
// } else {
// for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
// if (recipe == null) continue;
// ItemStack[] stacks = recipe.getRecipe();
// for (ItemStack stack : stacks) {
// if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
// arecipes.add(new CachedAlchemyRecipe(recipe));
// break;
// }
// }
// }
// }
// }
//
// @Override
// public void drawExtras(int id) {
// CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
// Minecraft.getMinecraft().fontRendererObj.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
// }
//
// public int getLPX(int lp) {
// if (lp < 10) return 122;
// else if (lp < 100) return 122;
// else if (lp < 1000) return 130;
// else if (lp < 10000) return 127;
// else if (lp < 100000) return 124;
// return 122;
// }
//
// @Override
// public String getRecipeName() {
// return StatCollector.translateToLocal("tile.blockWritingTable.name");
// }
//
// @Override
// public String getGuiTexture() {
// return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
// }
//}

View file

@ -1,187 +1,187 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
/**
* NEI Altar Recipe Handler by joshie *
*/
public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
public class CachedAltarRecipe extends CachedRecipe {
PositionedStack input;
// PositionedStack inputItems;
PositionedStack output;
int tier, lp_amount, consumption, drain;
public CachedAltarRecipe(AltarRecipe recipe) {
// inputItems = new PositionedStack(recipe.input, 38, 2, false);
input = new PositionedStack(recipe.requiredItem, 38, 2, false);
output = new PositionedStack(recipe.result, 132, 32, false);
tier = recipe.minTier;
lp_amount = recipe.liquidRequired;
consumption = recipe.consumptionRate;
drain = recipe.drainRate;
}
@Override
public PositionedStack getIngredient() {
return input;
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) {
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result)) {
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient)) {
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
}
}
}
//Mouse Position helper
public Point getMouse(int width, int height) {
Point mousepos = getMousePosition();
int guiLeft = (width - 176) / 2;
int guiTop = (height - 166) / 2;
Point relMouse = new Point(mousepos.x - guiLeft, mousepos.y - guiTop);
return relMouse;
}
//width helper, getting width normal way hates me on compile
public int getGuiWidth(GuiRecipe gui) {
try {
Field f = gui.getClass().getField("width");
return (Integer) f.get(gui);
} catch (NoSuchFieldException e) {
try {
Field f = gui.getClass().getField("field_146294_l");
return (Integer) f.get(gui);
} catch (Exception e2) {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
//height helper, getting height normal way hates me on compile
public int getGuiHeight(GuiRecipe gui) {
try {
Field f = gui.getClass().getField("height");
return (Integer) f.get(gui);
} catch (NoSuchFieldException e) {
try {
Field f = gui.getClass().getField("field_146295_m");
return (Integer) f.get(gui);
} catch (Exception e2) {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
@Override
public void drawExtras(int id) {
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0);
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0);
}
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int id) {
currenttip = super.handleTooltip(gui, currenttip, id);
Point mouse = getMouse(getGuiWidth(gui), getGuiHeight(gui));
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
int yLow = id % 2 == 0 ? 38 : 102;
int yHigh = id % 2 == 0 ? 72 : 136;
if(mouse.x >= 19 && mouse.x <= 80 && mouse.y >= yLow && mouse.y <= yHigh) {
currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
}
return currenttip;
}
@Override
public String getOverlayIdentifier() {
return "altarrecipes";
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar"));
}
@Override
public String getRecipeName() {
return " " + StatCollector.translateToLocal("tile.bloodAltar.name");
}
@Override
public String getGuiTexture() {
return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString();
}
public static Point getMousePosition() {
Dimension size = displaySize();
Dimension res = displayRes();
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
}
public static Dimension displaySize() {
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
}
public static Dimension displayRes() {
Minecraft mc = Minecraft.getMinecraft();
return new Dimension(mc.displayWidth, mc.displayHeight);
}
}
//package WayofTime.alchemicalWizardry.client.nei;
//
//import java.awt.Dimension;
//import java.awt.Point;
//import java.awt.Rectangle;
//import java.lang.reflect.Field;
//import java.util.List;
//
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.ScaledResolution;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.ResourceLocation;
//import net.minecraft.util.StatCollector;
//
//import org.lwjgl.input.Mouse;
//
//import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
//import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
//import codechicken.nei.NEIServerUtils;
//import codechicken.nei.PositionedStack;
//import codechicken.nei.recipe.GuiRecipe;
//import codechicken.nei.recipe.TemplateRecipeHandler;
//
///**
// * NEI Altar Recipe Handler by joshie *
// */
//public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
// public class CachedAltarRecipe extends CachedRecipe {
// PositionedStack input;
//// PositionedStack inputItems;
// PositionedStack output;
// int tier, lp_amount, consumption, drain;
//
// public CachedAltarRecipe(AltarRecipe recipe) {
//// inputItems = new PositionedStack(recipe.input, 38, 2, false);
// input = new PositionedStack(recipe.requiredItem, 38, 2, false);
// output = new PositionedStack(recipe.result, 132, 32, false);
// tier = recipe.minTier;
// lp_amount = recipe.liquidRequired;
// consumption = recipe.consumptionRate;
// drain = recipe.drainRate;
// }
//
// @Override
// public PositionedStack getIngredient() {
// return input;
// }
//
// @Override
// public PositionedStack getResult() {
// return output;
// }
// }
//
// @Override
// public void loadCraftingRecipes(String outputId, Object... results) {
// if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) {
// for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
// if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
// }
// } else {
// super.loadCraftingRecipes(outputId, results);
// }
// }
//
// @Override
// public void loadCraftingRecipes(ItemStack result) {
// for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
// if(NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result)) {
// if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
// }
// }
// }
//
// @Override
// public void loadUsageRecipes(ItemStack ingredient) {
// for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
// if(NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient)) {
// if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
// }
// }
// }
//
// //Mouse Position helper
// public Point getMouse(int width, int height) {
// Point mousepos = getMousePosition();
// int guiLeft = (width - 176) / 2;
// int guiTop = (height - 166) / 2;
// Point relMouse = new Point(mousepos.x - guiLeft, mousepos.y - guiTop);
// return relMouse;
// }
//
// //width helper, getting width normal way hates me on compile
// public int getGuiWidth(GuiRecipe gui) {
// try {
// Field f = gui.getClass().getField("width");
// return (Integer) f.get(gui);
// } catch (NoSuchFieldException e) {
// try {
// Field f = gui.getClass().getField("field_146294_l");
// return (Integer) f.get(gui);
// } catch (Exception e2) {
// return 0;
// }
// } catch (Exception e) {
// e.printStackTrace();
// return 0;
// }
// }
//
// //height helper, getting height normal way hates me on compile
// public int getGuiHeight(GuiRecipe gui) {
// try {
// Field f = gui.getClass().getField("height");
// return (Integer) f.get(gui);
// } catch (NoSuchFieldException e) {
// try {
// Field f = gui.getClass().getField("field_146295_m");
// return (Integer) f.get(gui);
// } catch (Exception e2) {
// return 0;
// }
// } catch (Exception e) {
// e.printStackTrace();
// return 0;
// }
// }
//
// @Override
// public void drawExtras(int id) {
// CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
// Minecraft.getMinecraft().fontRendererObj.drawString("\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0);
// Minecraft.getMinecraft().fontRendererObj.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0);
// }
//
// @Override
// public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int id) {
// currenttip = super.handleTooltip(gui, currenttip, id);
// Point mouse = getMouse(getGuiWidth(gui), getGuiHeight(gui));
// CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
// int yLow = id % 2 == 0 ? 38 : 102;
// int yHigh = id % 2 == 0 ? 72 : 136;
// if(mouse.x >= 19 && mouse.x <= 80 && mouse.y >= yLow && mouse.y <= yHigh) {
// currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
// currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
// }
//
// return currenttip;
// }
//
// @Override
// public String getOverlayIdentifier() {
// return "altarrecipes";
// }
//
// @Override
// public void loadTransferRects() {
// transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar"));
// }
//
// @Override
// public String getRecipeName() {
// return " " + StatCollector.translateToLocal("tile.bloodAltar.name");
// }
//
// @Override
// public String getGuiTexture() {
// return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString();
// }
//
// public static Point getMousePosition() {
// Dimension size = displaySize();
// Dimension res = displayRes();
// return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
// }
//
// public static Dimension displaySize() {
// Minecraft mc = Minecraft.getMinecraft();
// ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
// return new Dimension(res.getScaledWidth(), res.getScaledHeight());
// }
//
// public static Dimension displayRes() {
// Minecraft mc = Minecraft.getMinecraft();
// return new Dimension(mc.displayWidth, mc.displayHeight);
// }
//}

View file

@ -1,136 +1,136 @@
package WayofTime.alchemicalWizardry.client.nei;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Mouse;
import java.awt.*;
/**
* Binding Ritual Handler by Arcaratus
*/
public class NEIBindingRitualHandler extends TemplateRecipeHandler
{
public class CachedBindingRecipe extends CachedRecipe
{
PositionedStack input, output;
public CachedBindingRecipe(BindingRecipe recipe)
{
input = new PositionedStack(recipe.requiredItem, 37, 21, false);
output = new PositionedStack(recipe.outputItem, 110, 21, false);
}
@Override
public PositionedStack getIngredient()
{
return input;
}
@Override
public PositionedStack getResult()
{
return output;
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class)
{
for (BindingRecipe recipe : BindingRegistry.bindingRecipes)
{
if (recipe != null && recipe.outputItem != null)
{
arecipes.add(new CachedBindingRecipe(recipe));
}
}
}
else
{
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result)
{
for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
{
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.outputItem, result))
{
if (recipe != null && recipe.outputItem != null)
{
arecipes.add(new CachedBindingRecipe(recipe));
}
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
{
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient))
{
if (recipe != null && recipe.outputItem != null)
{
arecipes.add(new CachedBindingRecipe(recipe));
}
}
}
}
@Override
public String getOverlayIdentifier()
{
return "alchemicalwizardry.bindingritual";
}
@Override
public void loadTransferRects()
{
transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual"));
}
@Override
public String getRecipeName()
{
return "Binding Ritual";
}
@Override
public String getGuiTexture()
{
return new ResourceLocation("alchemicalwizardry", "gui/nei/bindingRitual.png").toString();
}
public static Point getMousePosition()
{
Dimension size = displaySize();
Dimension res = displayRes();
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
}
public static Dimension displaySize()
{
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
}
public static Dimension displayRes()
{
Minecraft mc = Minecraft.getMinecraft();
return new Dimension(mc.displayWidth, mc.displayHeight);
}
}
//package WayofTime.alchemicalWizardry.client.nei;
//
//import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
//import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
//import codechicken.nei.NEIServerUtils;
//import codechicken.nei.PositionedStack;
//import codechicken.nei.recipe.TemplateRecipeHandler;
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.ScaledResolution;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.ResourceLocation;
//import org.lwjgl.input.Mouse;
//
//import java.awt.*;
//
///**
// * Binding Ritual Handler by Arcaratus
// */
//public class NEIBindingRitualHandler extends TemplateRecipeHandler
//{
// public class CachedBindingRecipe extends CachedRecipe
// {
// PositionedStack input, output;
//
// public CachedBindingRecipe(BindingRecipe recipe)
// {
// input = new PositionedStack(recipe.requiredItem, 37, 21, false);
// output = new PositionedStack(recipe.outputItem, 110, 21, false);
// }
//
// @Override
// public PositionedStack getIngredient()
// {
// return input;
// }
//
// @Override
// public PositionedStack getResult()
// {
// return output;
// }
// }
//
// @Override
// public void loadCraftingRecipes(String outputId, Object... results)
// {
// if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class)
// {
// for (BindingRecipe recipe : BindingRegistry.bindingRecipes)
// {
// if (recipe != null && recipe.outputItem != null)
// {
// arecipes.add(new CachedBindingRecipe(recipe));
// }
// }
// }
// else
// {
// super.loadCraftingRecipes(outputId, results);
// }
// }
//
// @Override
// public void loadCraftingRecipes(ItemStack result)
// {
// for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
// {
// if (NEIServerUtils.areStacksSameTypeCrafting(recipe.outputItem, result))
// {
// if (recipe != null && recipe.outputItem != null)
// {
// arecipes.add(new CachedBindingRecipe(recipe));
// }
// }
// }
// }
//
// @Override
// public void loadUsageRecipes(ItemStack ingredient)
// {
// for (BindingRecipe recipe: BindingRegistry.bindingRecipes)
// {
// if (NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient))
// {
// if (recipe != null && recipe.outputItem != null)
// {
// arecipes.add(new CachedBindingRecipe(recipe));
// }
// }
// }
// }
//
// @Override
// public String getOverlayIdentifier()
// {
// return "alchemicalwizardry.bindingritual";
// }
//
// @Override
// public void loadTransferRects()
// {
// transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual"));
// }
//
// @Override
// public String getRecipeName()
// {
// return "Binding Ritual";
// }
//
// @Override
// public String getGuiTexture()
// {
// return new ResourceLocation("alchemicalwizardry", "gui/nei/bindingRitual.png").toString();
// }
//
// public static Point getMousePosition()
// {
// Dimension size = displaySize();
// Dimension res = displayRes();
// return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
// }
//
// public static Dimension displaySize()
// {
// Minecraft mc = Minecraft.getMinecraft();
// ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
// return new Dimension(res.getScaledWidth(), res.getScaledHeight());
// }
//
// public static Dimension displayRes()
// {
// Minecraft mc = Minecraft.getMinecraft();
// return new Dimension(mc.displayWidth, mc.displayHeight);
// }
//}

View file

@ -1,142 +1,142 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapedRecipeHandler;
/**
* NEI Blood Orb Shaped Recipe Handler by joshie *
*/
public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
public class CachedBloodOrbRecipe extends CachedShapedRecipe {
public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) {
super(width, height, items, out);
}
@Override
public void setIngredients(int width, int height, Object[] items) {
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (items[y * width + x] == null)
continue;
Object o = items[y * width + x];
if (o instanceof ItemStack) {
PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false);
stack.setMaxSize(1);
ingredients.add(stack);
} else if (o instanceof Integer) {
ArrayList<ItemStack> orbs = new ArrayList();
for (Item item : NEIConfig.bloodOrbs) {
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
orbs.add(new ItemStack(item));
}
}
PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
stack.setMaxSize(1);
ingredients.add(stack);
}else if(o instanceof List)
{
PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false);
stack.setMaxSize(1);
ingredients.add(stack);
}
}
}
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe) {
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
if (recipe == null)
continue;
recipe.computeVisuals();
arecipes.add(recipe);
}
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe) {
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
if (recipe == null || !NEIServerUtils.areStacksSameTypeCrafting(recipe.result.item, result))
continue;
recipe.computeVisuals();
arecipes.add(recipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedBloodOrbRecipe)
recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
continue;
recipe.computeVisuals();
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) {
int width;
int height;
try {
width = recipe.width;
height = recipe.height;
} catch (Exception e) {
e.printStackTrace();
return null;
}
Object[] items = recipe.getInput();
for (Object item : items)
if (item instanceof List && ((List<?>) item).isEmpty())// ore
// handler,
// no ores
return null;
return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput());
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
}
}
//package WayofTime.alchemicalWizardry.client.nei;
//
//import java.awt.Rectangle;
//import java.util.ArrayList;
//import java.util.List;
//
//import net.minecraft.item.Item;
//import net.minecraft.item.ItemStack;
//import net.minecraft.item.crafting.CraftingManager;
//import net.minecraft.item.crafting.IRecipe;
//import net.minecraft.util.StatCollector;
//import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
//import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
//import codechicken.nei.NEIServerUtils;
//import codechicken.nei.PositionedStack;
//import codechicken.nei.recipe.ShapedRecipeHandler;
//
///**
// * NEI Blood Orb Shaped Recipe Handler by joshie *
// */
//public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
// public class CachedBloodOrbRecipe extends CachedShapedRecipe {
// public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) {
// super(width, height, items, out);
// }
//
// @Override
// public void setIngredients(int width, int height, Object[] items) {
// for (int x = 0; x < width; x++) {
// for (int y = 0; y < height; y++) {
// if (items[y * width + x] == null)
// continue;
//
// Object o = items[y * width + x];
// if (o instanceof ItemStack) {
// PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false);
// stack.setMaxSize(1);
// ingredients.add(stack);
// } else if (o instanceof Integer) {
// ArrayList<ItemStack> orbs = new ArrayList();
// for (Item item : NEIConfig.bloodOrbs) {
// if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
// orbs.add(new ItemStack(item));
// }
// }
//
// PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
// stack.setMaxSize(1);
// ingredients.add(stack);
// }else if(o instanceof List)
// {
// PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false);
// stack.setMaxSize(1);
// ingredients.add(stack);
// }
// }
// }
// }
// }
//
// @Override
// public void loadCraftingRecipes(String outputId, Object... results) {
// if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
// for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
// if (irecipe instanceof ShapedBloodOrbRecipe) {
// CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
// if (recipe == null)
// continue;
//
// recipe.computeVisuals();
// arecipes.add(recipe);
// }
// }
// } else {
// super.loadCraftingRecipes(outputId, results);
// }
// }
//
// @Override
// public void loadCraftingRecipes(ItemStack result) {
// for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
// if (irecipe instanceof ShapedBloodOrbRecipe) {
// CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
// if (recipe == null || !NEIServerUtils.areStacksSameTypeCrafting(recipe.result.item, result))
// continue;
//
// recipe.computeVisuals();
// arecipes.add(recipe);
// }
// }
// }
//
// @Override
// public void loadUsageRecipes(ItemStack ingredient) {
// for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
// CachedShapedRecipe recipe = null;
// if (irecipe instanceof ShapedBloodOrbRecipe)
// recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
//
// if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
// continue;
//
// recipe.computeVisuals();
// if (recipe.contains(recipe.ingredients, ingredient)) {
// recipe.setIngredientPermutation(recipe.ingredients, ingredient);
// arecipes.add(recipe);
// }
// }
// }
//
// private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) {
// int width;
// int height;
// try {
// width = recipe.width;
// height = recipe.height;
// } catch (Exception e) {
// e.printStackTrace();
// return null;
// }
//
// Object[] items = recipe.getInput();
// for (Object item : items)
// if (item instanceof List && ((List<?>) item).isEmpty())// ore
// // handler,
// // no ores
// return null;
//
// return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput());
// }
//
// @Override
// public void loadTransferRects() {
// transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
// }
//
//
// @Override
// public String getRecipeName() {
// return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
// }
//}

View file

@ -1,135 +1,135 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapelessRecipeHandler;
/**
* NEI Blood Orb Shapeless Recipe Handler by joshie *
*/
public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
public class CachedBloodOrbRecipe extends CachedShapelessRecipe {
public CachedBloodOrbRecipe(ArrayList<Object> items, ItemStack recipeOutput) {
super(items, recipeOutput);
}
@Override
public void setIngredients(List<?> items) {
ingredients.clear();
for (int ingred = 0; ingred < items.size(); ingred++) {
Object o = items.get(ingred);
if (o instanceof ItemStack) {
PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
stack.setMaxSize(1);
ingredients.add(stack);
} else if (o instanceof Integer) {
ArrayList<ItemStack> orbs = new ArrayList();
for (Item item : NEIConfig.bloodOrbs) {
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
orbs.add(new ItemStack(item));
}
}
PositionedStack stack = new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
stack.setMaxSize(1);
ingredients.add(stack);
}else if(o instanceof List)
{
PositionedStack stack = new PositionedStack(o, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
stack.setMaxSize(1);
ingredients.add(stack);
}
}
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedBloodOrbRecipe recipe = null;
if (irecipe instanceof ShapelessBloodOrbRecipe)
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
if (recipe == null)
continue;
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
CachedBloodOrbRecipe recipe = null;
if (irecipe instanceof ShapelessBloodOrbRecipe)
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
if (recipe == null)
continue;
arecipes.add(recipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedBloodOrbRecipe recipe = null;
if (irecipe instanceof ShapelessBloodOrbRecipe)
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
if (recipe == null)
continue;
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) {
ArrayList<Object> items = recipe.getInput();
for (Object item : items)
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
return null;
return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput());
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getOverlayIdentifier() {
return "crafting";
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless");
}
}
//package WayofTime.alchemicalWizardry.client.nei;
//
//import java.awt.Rectangle;
//import java.util.ArrayList;
//import java.util.List;
//
//import net.minecraft.item.Item;
//import net.minecraft.item.ItemStack;
//import net.minecraft.item.crafting.CraftingManager;
//import net.minecraft.item.crafting.IRecipe;
//import net.minecraft.util.StatCollector;
//import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
//import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
//import codechicken.nei.NEIServerUtils;
//import codechicken.nei.PositionedStack;
//import codechicken.nei.recipe.ShapelessRecipeHandler;
//
///**
// * NEI Blood Orb Shapeless Recipe Handler by joshie *
// */
//public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
// public class CachedBloodOrbRecipe extends CachedShapelessRecipe {
// public CachedBloodOrbRecipe(ArrayList<Object> items, ItemStack recipeOutput) {
// super(items, recipeOutput);
// }
//
// @Override
// public void setIngredients(List<?> items) {
// ingredients.clear();
// for (int ingred = 0; ingred < items.size(); ingred++) {
// Object o = items.get(ingred);
// if (o instanceof ItemStack) {
// PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
// stack.setMaxSize(1);
// ingredients.add(stack);
// } else if (o instanceof Integer) {
// ArrayList<ItemStack> orbs = new ArrayList();
// for (Item item : NEIConfig.bloodOrbs) {
// if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
// orbs.add(new ItemStack(item));
// }
// }
//
// PositionedStack stack = new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
// stack.setMaxSize(1);
// ingredients.add(stack);
// }else if(o instanceof List)
// {
// PositionedStack stack = new PositionedStack(o, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
// stack.setMaxSize(1);
// ingredients.add(stack);
// }
// }
// }
// }
//
// @Override
// public void loadCraftingRecipes(String outputId, Object... results) {
// if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
// List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
// for (IRecipe irecipe : allrecipes) {
// CachedBloodOrbRecipe recipe = null;
// if (irecipe instanceof ShapelessBloodOrbRecipe)
// recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
//
// if (recipe == null)
// continue;
//
// arecipes.add(recipe);
// }
// } else {
// super.loadCraftingRecipes(outputId, results);
// }
// }
//
// @Override
// public void loadCraftingRecipes(ItemStack result) {
// List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
// for (IRecipe irecipe : allrecipes) {
// if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
// CachedBloodOrbRecipe recipe = null;
// if (irecipe instanceof ShapelessBloodOrbRecipe)
// recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
//
// if (recipe == null)
// continue;
//
// arecipes.add(recipe);
// }
// }
// }
//
// @Override
// public void loadUsageRecipes(ItemStack ingredient) {
// List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
// for (IRecipe irecipe : allrecipes) {
// CachedBloodOrbRecipe recipe = null;
// if (irecipe instanceof ShapelessBloodOrbRecipe)
// recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
//
// if (recipe == null)
// continue;
//
// if (recipe.contains(recipe.ingredients, ingredient)) {
// recipe.setIngredientPermutation(recipe.ingredients, ingredient);
// arecipes.add(recipe);
// }
// }
// }
//
// public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) {
// ArrayList<Object> items = recipe.getInput();
//
// for (Object item : items)
// if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
// return null;
//
// return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput());
// }
//
// @Override
// public void loadTransferRects() {
// transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
// }
//
// @Override
// public String getOverlayIdentifier() {
// return "crafting";
// }
//
// @Override
// public String getRecipeName() {
// return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless");
// }
//}

View file

@ -1,35 +1,35 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.util.ArrayList;
import net.minecraft.item.Item;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
public class NEIConfig implements IConfigureNEI {
public static ArrayList<Item> bloodOrbs = new ArrayList<Item>();
@Override
public void loadConfig() {
API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
API.registerUsageHandler(new NEIAlchemyRecipeHandler());
API.registerRecipeHandler(new NEIAltarRecipeHandler());
API.registerUsageHandler(new NEIAltarRecipeHandler());
API.registerRecipeHandler(new NEIBloodOrbShapedHandler());
API.registerUsageHandler(new NEIBloodOrbShapedHandler());
API.registerRecipeHandler(new NEIBloodOrbShapelessHandler());
API.registerUsageHandler(new NEIBloodOrbShapelessHandler());
API.registerRecipeHandler(new NEIBindingRitualHandler());
API.registerUsageHandler(new NEIBindingRitualHandler());
}
@Override
public String getName() {
return "Blood Magic NEI";
}
@Override
public String getVersion() {
return "1.3";
}
}
//package WayofTime.alchemicalWizardry.client.nei;
//
//import java.util.ArrayList;
//
//import net.minecraft.item.Item;
//import codechicken.nei.api.API;
//import codechicken.nei.api.IConfigureNEI;
//
//public class NEIConfig implements IConfigureNEI {
// public static ArrayList<Item> bloodOrbs = new ArrayList<Item>();
//
// @Override
// public void loadConfig() {
// API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
// API.registerUsageHandler(new NEIAlchemyRecipeHandler());
// API.registerRecipeHandler(new NEIAltarRecipeHandler());
// API.registerUsageHandler(new NEIAltarRecipeHandler());
// API.registerRecipeHandler(new NEIBloodOrbShapedHandler());
// API.registerUsageHandler(new NEIBloodOrbShapedHandler());
// API.registerRecipeHandler(new NEIBloodOrbShapelessHandler());
// API.registerUsageHandler(new NEIBloodOrbShapelessHandler());
// API.registerRecipeHandler(new NEIBindingRitualHandler());
// API.registerUsageHandler(new NEIBindingRitualHandler());
// }
//
// @Override
// public String getName() {
// return "Blood Magic NEI";
// }
//
// @Override
// public String getVersion() {
// return "1.3";
// }
//}

View file

@ -29,7 +29,7 @@ public class HUDElement
public boolean showDamageOverlay = false;
public boolean showItemCount = false;
static RenderItem itemRenderer = new RenderItem();
static RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value)
{
@ -54,8 +54,8 @@ public class HUDElement
private void initSize()
{
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) :
Math.max(mc.fontRenderer.FONT_HEIGHT, iconH);
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT * 2, iconH) :
Math.max(mc.fontRendererObj.FONT_HEIGHT, iconH);
if (itemStack != null)
{
@ -65,7 +65,7 @@ public class HUDElement
if (showValue)
{
maxDamage = itemStack.getMaxDamage() + 1;
damage = maxDamage - itemStack.getItemDamageForDisplay();
damage = maxDamage - itemStack.getItemDamage();
boolean showSpecialValue = true;
boolean showValue = false;
@ -88,17 +88,17 @@ public class HUDElement
(damage * 100 / maxDamage) + "%";
}
itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage));
itemDamageW = mc.fontRendererObj.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);
Math.max(mc.fontRendererObj.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW);
}
itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName));
itemNameW = mc.fontRendererObj.getStringWidth(HUDUtils.stripCtrl(itemName));
}
}
@ -114,27 +114,27 @@ public class HUDElement
boolean toRight = true;
if (toRight)
{
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount);
itemRenderer.func_180450_b(itemStack, x - (iconW + padW), y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRendererObj, 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,
mc.fontRendererObj.drawString(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
mc.fontRendererObj.drawString(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW,
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
} else
{
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount);
itemRenderer.func_180450_b(itemStack, x, y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRendererObj, 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,
mc.fontRendererObj.drawString(itemName + "\247r", x + iconW + padW, y, 0xffffff);
mc.fontRendererObj.drawString(itemDamage + "\247r", x + iconW + padW,
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -4,11 +4,13 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.player.EntityPlayer;
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;
/**
@ -169,12 +171,13 @@ public final class HUDUtils
{
float var7 = 0.00390625F;
float var8 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
tessellator.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
tessellator.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer wr = tessellator.getWorldRenderer();
wr.startDrawingQuads();
wr.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
wr.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
wr.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
wr.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
tessellator.draw();
}
@ -195,12 +198,12 @@ public final class HUDUtils
{
if (itemStack.isItemDamaged() && showDamageBar)
{
int var11 = (int) Math.round(13.0D - itemStack.getItemDamageForDisplay() * 13.0D / itemStack.getMaxDamage());
int var7 = (int) Math.round(255.0D - itemStack.getItemDamageForDisplay() * 255.0D / itemStack.getMaxDamage());
int var11 = (int) Math.round(13.0D - itemStack.getItemDamage() * 13.0D / itemStack.getMaxDamage());
int var7 = (int) Math.round(255.0D - itemStack.getItemDamage() * 255.0D / itemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator var8 = Tessellator.instance;
Tessellator var8 = Tessellator.getInstance();
int var9 = 255 - var7 << 16 | var7 << 8;
int var10 = (255 - var7) / 4 << 16 | 16128;
renderQuad(var8, x + 2, y + 13, 13, 2, 0);
@ -226,7 +229,7 @@ public final class HUDUtils
String var6 = "" + count;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
fontRenderer.drawStringWithShadow(var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215);
fontRenderer.drawString(var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
@ -240,12 +243,13 @@ public final class HUDUtils
*/
public static void renderQuad(Tessellator tessellator, int x, int y, int width, int height, int color)
{
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.addVertex((x + 0), (y + 0), 0.0D);
tessellator.addVertex((x + 0), (y + height), 0.0D);
tessellator.addVertex((x + width), (y + height), 0.0D);
tessellator.addVertex((x + width), (y + 0), 0.0D);
WorldRenderer wr = tessellator.getWorldRenderer();
wr.startDrawingQuads();
// wr.setColorOpaque_I(color);
wr.addVertex((x + 0), (y + 0), 0.0D);
wr.addVertex((x + 0), (y + height), 0.0D);
wr.addVertex((x + width), (y + height), 0.0D);
wr.addVertex((x + width), (y + 0), 0.0D);
tessellator.draw();
}

View file

@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.world.World;
/*
@ -16,10 +16,11 @@ public class RenderFakeBlocks
double maxX = minX + 1;
double maxY = minY + 1;
double maxZ = minZ + 1;
Tessellator tessellator = Tessellator.instance;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer wr = tessellator.getWorldRenderer();
tessellator.startDrawingQuads();
tessellator.setColorRGBA(255, 255, 255, 200);
wr.startDrawingQuads();
// wr.setColorRGBA(255, 255, 255, 200);
float texMinU, texMaxU, texMinV, texMaxV;
@ -27,80 +28,76 @@ public class RenderFakeBlocks
texMaxU = getMaxU(block, meta, 0);
texMinV = getMinV(block, meta, 0);
texMaxV = getMaxV(block, meta, 0);
tessellator.addVertexWithUV(minX, minY, minZ, texMinU, texMinV);
tessellator.addVertexWithUV(maxX, minY, minZ, texMaxU, texMinV);
tessellator.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
tessellator.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
wr.addVertexWithUV(minX, minY, minZ, texMinU, texMinV);
wr.addVertexWithUV(maxX, minY, minZ, texMaxU, texMinV);
wr.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
wr.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
texMinU = getMinU(block, meta, 1);
texMaxU = getMaxU(block, meta, 1);
texMinV = getMinV(block, meta, 1);
texMaxV = getMaxV(block, meta, 1);
tessellator.addVertexWithUV(minX, maxY, maxZ, texMinU, texMaxV);
tessellator.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMaxV);
tessellator.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
tessellator.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
wr.addVertexWithUV(minX, maxY, maxZ, texMinU, texMaxV);
wr.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMaxV);
wr.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
wr.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
texMinU = getMinU(block, meta, 2);
texMaxU = getMaxU(block, meta, 2);
texMinV = getMinV(block, meta, 2);
texMaxV = getMaxV(block, meta, 2);
tessellator.addVertexWithUV(maxX, minY, minZ, texMinU, texMaxV);
tessellator.addVertexWithUV(minX, minY, minZ, texMaxU, texMaxV);
tessellator.addVertexWithUV(minX, maxY, minZ, texMaxU, texMinV);
tessellator.addVertexWithUV(maxX, maxY, minZ, texMinU, texMinV);
wr.addVertexWithUV(maxX, minY, minZ, texMinU, texMaxV);
wr.addVertexWithUV(minX, minY, minZ, texMaxU, texMaxV);
wr.addVertexWithUV(minX, maxY, minZ, texMaxU, texMinV);
wr.addVertexWithUV(maxX, maxY, minZ, texMinU, texMinV);
texMinU = getMinU(block, meta, 3);
texMaxU = getMaxU(block, meta, 3);
texMinV = getMinV(block, meta, 3);
texMaxV = getMaxV(block, meta, 3);
tessellator.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
tessellator.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
tessellator.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMinV);
tessellator.addVertexWithUV(minX, maxY, maxZ, texMinU, texMinV);
wr.addVertexWithUV(minX, minY, maxZ, texMinU, texMaxV);
wr.addVertexWithUV(maxX, minY, maxZ, texMaxU, texMaxV);
wr.addVertexWithUV(maxX, maxY, maxZ, texMaxU, texMinV);
wr.addVertexWithUV(minX, maxY, maxZ, texMinU, texMinV);
texMinU = getMinU(block, meta, 4);
texMaxU = getMaxU(block, meta, 4);
texMinV = getMinV(block, meta, 4);
texMaxV = getMaxV(block, meta, 4);
tessellator.addVertexWithUV(minX, minY, minZ, texMinU, texMaxV);
tessellator.addVertexWithUV(minX, minY, maxZ, texMaxU, texMaxV);
tessellator.addVertexWithUV(minX, maxY, maxZ, texMaxU, texMinV);
tessellator.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
wr.addVertexWithUV(minX, minY, minZ, texMinU, texMaxV);
wr.addVertexWithUV(minX, minY, maxZ, texMaxU, texMaxV);
wr.addVertexWithUV(minX, maxY, maxZ, texMaxU, texMinV);
wr.addVertexWithUV(minX, maxY, minZ, texMinU, texMinV);
texMinU = getMinU(block, meta, 5);
texMaxU = getMaxU(block, meta, 5);
texMinV = getMinV(block, meta, 5);
texMaxV = getMaxV(block, meta, 5);
tessellator.addVertexWithUV(maxX, minY, maxZ, texMinU, texMaxV);
tessellator.addVertexWithUV(maxX, minY, minZ, texMaxU, texMaxV);
tessellator.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
tessellator.addVertexWithUV(maxX, maxY, maxZ, texMinU, texMinV);
wr.addVertexWithUV(maxX, minY, maxZ, texMinU, texMaxV);
wr.addVertexWithUV(maxX, minY, minZ, texMaxU, texMaxV);
wr.addVertexWithUV(maxX, maxY, minZ, texMaxU, texMinV);
wr.addVertexWithUV(maxX, maxY, maxZ, texMinU, texMinV);
tessellator.draw();
}
private static float getMinU(Block block, int meta, int side)
{
IIcon icon = block.getIcon(side, meta);
return icon.getMinU();
return 0;
}
private static float getMaxU(Block block, int meta, int side)
{
IIcon icon = block.getIcon(side, meta);
return icon.getMaxU();
return 256;
}
private static float getMinV(Block block, int meta, int side)
{
IIcon icon = block.getIcon(side, meta);
return icon.getMinV();
return 0;
}
private static float getMaxV(Block block, int meta, int side)
{
IIcon icon = block.getIcon(side, meta);
return icon.getMaxV();
return 256;
}
}

View file

@ -7,14 +7,14 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@ -179,11 +179,9 @@ public class RenderHelper
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY;
int z = movingobjectposition.blockZ;
BlockPos pos = movingobjectposition.func_178782_a();
TileEntity tile = world.getTileEntity(x, y, z);
TileEntity tile = world.getTileEntity(pos);
if (!(tile instanceof IReagentHandler))
{
@ -192,7 +190,7 @@ public class RenderHelper
IReagentHandler relay = (IReagentHandler) tile;
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
ReagentContainerInfo[] infos = relay.getContainerInfo(movingobjectposition.field_178784_b);
if (infos != null)
{
@ -250,12 +248,13 @@ public class RenderHelper
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)p_73729_1_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ * f), (p_73729_4_ + p_73729_6_) * f1);
tessellator.addVertexWithUV(p_73729_1_ + p_73729_5_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, (p_73729_4_ + p_73729_6_) * f1);
tessellator.addVertexWithUV(p_73729_1_ + p_73729_5_, (double)p_73729_2_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, p_73729_4_ * f1);
tessellator.addVertexWithUV((double)p_73729_1_, (double)p_73729_2_, (double)zLevel, (double)(p_73729_3_ * f), p_73729_4_ * f1);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer wr = tessellator.getWorldRenderer();
wr.startDrawingQuads();
wr.addVertexWithUV((double)p_73729_1_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ * f), (p_73729_4_ + p_73729_6_) * f1);
wr.addVertexWithUV(p_73729_1_ + p_73729_5_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, (p_73729_4_ + p_73729_6_) * f1);
wr.addVertexWithUV(p_73729_1_ + p_73729_5_, (double)p_73729_2_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, p_73729_4_ * f1);
wr.addVertexWithUV((double)p_73729_1_, (double)p_73729_2_, (double)zLevel, (double)(p_73729_3_ * f), p_73729_4_ * f1);
tessellator.draw();
}
@ -288,17 +287,6 @@ public class RenderHelper
GL11.glPopMatrix();
}
public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)p_94149_1_, (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMaxV());
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMaxV());
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)p_94149_2_, (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMinV());
tessellator.addVertexWithUV((double)p_94149_1_, (double)p_94149_2_, (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMinV());
tessellator.draw();
}
private static void displayArmorStatus(Minecraft mc)
{

View file

@ -1,7 +1,16 @@
package WayofTime.alchemicalWizardry.client.renderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.ModBlocks;
@ -11,13 +20,7 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
/*
* Created in Scala by Alex-Hawks
@ -30,22 +33,24 @@ public class RitualDivinerRender
public void render(RenderWorldLastEvent event)
{
Minecraft minecraft = Minecraft.getMinecraft();
EntityClientPlayerMP player = minecraft.thePlayer;
EntityPlayer player = minecraft.thePlayer;
World world = player.worldObj;
if (minecraft.objectMouseOver == null || minecraft.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
{
return;
}
BlockPos pos = minecraft.objectMouseOver.func_178782_a();
TileEntity tileEntity = world.getTileEntity(minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ);
TileEntity tileEntity = world.getTileEntity(pos);
if (!(tileEntity instanceof IMasterRitualStone))
{
return;
}
Vector3 vec3 = new Vector3(minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ);
Vector3 vec3 = new Vector3(pos.getX(), pos.getY(), pos.getZ());
double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.partialTicks;
double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.partialTicks;
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks;
@ -71,7 +76,7 @@ public class RitualDivinerRender
double minY = vX.y - posY;
double minZ = vX.z - posZ;
if (!world.getBlock(vX.x, vX.y, vX.z).isOpaqueCube())
if (!world.getBlockState(new BlockPos(vX.x, vX.y, vX.z)).getBlock().isOpaqueCube())
{
RenderFakeBlocks.drawFakeBlock(vX, ModBlocks.ritualStone, ritualComponent.getStoneType(), minX, minY, minZ, world);
}