/// <summary>
 /// Sets a new position for the renderer and setting it up so it can be reloaded with the new data for that position
 /// </summary>
 public void SetPosition(int par1, int par2, int par3)
 {
     if (par1 == PosX && par2 == PosY && par3 == PosZ)
     {
         return;
     }
     else
     {
         SetDontDraw();
         PosX      = par1;
         PosY      = par2;
         PosZ      = par3;
         PosXPlus  = par1 + 8;
         PosYPlus  = par2 + 8;
         PosZPlus  = par3 + 8;
         PosXClip  = par1 & 0x3ff;
         PosYClip  = par2;
         PosZClip  = par3 & 0x3ff;
         PosXMinus = par1 - PosXClip;
         PosYMinus = par2 - PosYClip;
         PosZMinus = par3 - PosZClip;
         float f = 6F;
         RendererBoundingBox = AxisAlignedBB.GetBoundingBox(par1 - f, par2 - f, par3 - f, (par1 + 16) + f, (par2 + 16) + f, (par3 + 16) + f);
         //GL.NewList(GlRenderList + 2, ListMode.Compile);
         RenderItem.RenderAABB(AxisAlignedBB.GetBoundingBoxFromPool(PosXClip - f, PosYClip - f, PosZClip - f, (PosXClip + 16) + f, (PosYClip + 16) + f, (PosZClip + 16) + f));
         //GL.EndList();
         MarkDirty();
         return;
     }
 }
Ejemplo n.º 2
0
        private RenderManager()
        {
            EntityRenderMap = new Dictionary <Type, Render>();
            EntityRenderMap[typeof(EntitySpider)]        = new RenderSpider();
            EntityRenderMap[typeof(EntityCaveSpider)]    = new RenderSpider();
            EntityRenderMap[typeof(EntityPig)]           = new RenderPig(new ModelPig(), new ModelPig(0.5F), 0.7F);
            EntityRenderMap[typeof(EntitySheep)]         = new RenderSheep(new ModelSheep2(), new ModelSheep1(), 0.7F);
            EntityRenderMap[typeof(EntityCow)]           = new RenderCow(new ModelCow(), 0.7F);
            EntityRenderMap[typeof(EntityMooshroom)]     = new RenderMooshroom(new ModelCow(), 0.7F);
            EntityRenderMap[typeof(EntityWolf)]          = new RenderWolf(new ModelWolf(), 0.5F);
            EntityRenderMap[typeof(EntityChicken)]       = new RenderChicken(new ModelChicken(), 0.3F);
            EntityRenderMap[typeof(EntityOcelot)]        = new RenderOcelot(new ModelOcelot(), 0.4F);
            EntityRenderMap[typeof(EntitySilverfish)]    = new RenderSilverfish();
            EntityRenderMap[typeof(EntityCreeper)]       = new RenderCreeper();
            EntityRenderMap[typeof(EntityEnderman)]      = new RenderEnderman();
            EntityRenderMap[typeof(EntitySnowman)]       = new RenderSnowMan();
            EntityRenderMap[typeof(EntitySkeleton)]      = new RenderBiped(new ModelSkeleton(), 0.5F);
            EntityRenderMap[typeof(EntityBlaze)]         = new RenderBlaze();
            EntityRenderMap[typeof(EntityZombie)]        = new RenderBiped(new ModelZombie(), 0.5F);
            EntityRenderMap[typeof(EntitySlime)]         = new RenderSlime(new ModelSlime(16), new ModelSlime(0), 0.25F);
            EntityRenderMap[typeof(EntityMagmaCube)]     = new RenderMagmaCube();
            EntityRenderMap[typeof(EntityPlayer)]        = new RenderPlayer();
            EntityRenderMap[typeof(EntityGiantZombie)]   = new RenderGiantZombie(new ModelZombie(), 0.5F, 6F);
            EntityRenderMap[typeof(EntityGhast)]         = new RenderGhast();
            EntityRenderMap[typeof(EntitySquid)]         = new RenderSquid(new ModelSquid(), 0.7F);
            EntityRenderMap[typeof(EntityVillager)]      = new RenderVillager();
            EntityRenderMap[typeof(EntityIronGolem)]     = new RenderIronGolem();
            EntityRenderMap[typeof(EntityLiving)]        = new RenderLiving(new ModelBiped(), 0.5F);
            EntityRenderMap[typeof(EntityDragon)]        = new RenderDragon();
            EntityRenderMap[typeof(EntityEnderCrystal)]  = new RenderEnderCrystal();
            EntityRenderMap[typeof(Entity)]              = new RenderEntity();
            EntityRenderMap[typeof(EntityPainting)]      = new RenderPainting();
            EntityRenderMap[typeof(EntityArrow)]         = new RenderArrow();
            EntityRenderMap[typeof(EntitySnowball)]      = new RenderSnowball(Item.Snowball.GetIconFromDamage(0));
            EntityRenderMap[typeof(EntityEnderPearl)]    = new RenderSnowball(Item.EnderPearl.GetIconFromDamage(0));
            EntityRenderMap[typeof(EntityEnderEye)]      = new RenderSnowball(Item.EyeOfEnder.GetIconFromDamage(0));
            EntityRenderMap[typeof(EntityEgg)]           = new RenderSnowball(Item.Egg.GetIconFromDamage(0));
            EntityRenderMap[typeof(EntityPotion)]        = new RenderSnowball(154);
            EntityRenderMap[typeof(EntityExpBottle)]     = new RenderSnowball(Item.ExpBottle.GetIconFromDamage(0));
            EntityRenderMap[typeof(EntityFireball)]      = new RenderFireball(2.0F);
            EntityRenderMap[typeof(EntitySmallFireball)] = new RenderFireball(0.5F);
            EntityRenderMap[typeof(EntityItem)]          = new RenderItem();
            EntityRenderMap[typeof(EntityXPOrb)]         = new RenderXPOrb();
            EntityRenderMap[typeof(EntityTNTPrimed)]     = new RenderTNTPrimed();
            EntityRenderMap[typeof(EntityFallingSand)]   = new RenderFallingSand();
            EntityRenderMap[typeof(EntityMinecart)]      = new RenderMinecart();
            EntityRenderMap[typeof(EntityBoat)]          = new RenderBoat();
            EntityRenderMap[typeof(EntityFishHook)]      = new RenderFish();
            EntityRenderMap[typeof(EntityLightningBolt)] = new RenderLightningBolt();
            Render render;

            for (IEnumerator <Render> iterator = EntityRenderMap.Values.GetEnumerator(); iterator.MoveNext(); render.SetRenderManager(this))
            {
                render = iterator.Current;
            }
        }
Ejemplo n.º 3
0
        protected void GenAchievementBackground(int par1, int par2, float par3)
        {
            int i = MathHelper2.Floor_double(Field_27116_m + (GuiMapX - Field_27116_m) * (double)par3);
            int j = MathHelper2.Floor_double(Field_27115_n + (GuiMapY - Field_27115_n) * (double)par3);

            if (i < guiMapTop)
            {
                i = guiMapTop;
            }

            if (j < guiMapLeft)
            {
                j = guiMapLeft;
            }

            if (i >= guiMapBottom)
            {
                i = guiMapBottom - 1;
            }

            if (j >= guiMapRight)
            {
                j = guiMapRight - 1;
            }

            int k  = Mc.RenderEngineOld.GetTexture("/terrain.png");
            int l  = Mc.RenderEngineOld.GetTexture("/achievement/bg.png");
            int i1 = (Width - AchievementsPaneWidth) / 2;
            int j1 = (Height - AchievementsPaneHeight) / 2;
            int k1 = i1 + 16;
            int l1 = j1 + 17;

            ZLevel = 0.0F;
            //GL.DepthFunc(DepthFunction.Gequal);
            //GL.PushMatrix();
            //GL.Translate(0.0F, 0.0F, -200F);
            //GL.Enable(EnableCap.Texture2D);
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.RescaleNormal);
            //GL.Enable(EnableCap.ColorMaterial);
            Mc.RenderEngineOld.BindTexture(k);
            int    i2     = i + 288 >> 4;
            int    j2     = j + 288 >> 4;
            int    k2     = (i + 288) % 16;
            int    l2     = (j + 288) % 16;
            Random random = new Random();

            for (int i3 = 0; i3 * 16 - l2 < 155; i3++)
            {
                float f = 0.6F - ((float)(j2 + i3) / 25F) * 0.3F;
                //GL.Color4(f, f, f, 1.0F);

                for (int k3 = 0; k3 * 16 - k2 < 224; k3++)
                {
                    random = new Random(1234 + i2 + k3);
                    random.Next();
                    int j4 = random.Next(1 + j2 + i3) + (j2 + i3) / 2;
                    int l4 = Block.Sand.BlockIndexInTexture;

                    if (j4 > 37 || j2 + i3 == 35)
                    {
                        l4 = Block.Bedrock.BlockIndexInTexture;
                    }
                    else if (j4 == 22)
                    {
                        if (random.Next(2) == 0)
                        {
                            l4 = Block.OreDiamond.BlockIndexInTexture;
                        }
                        else
                        {
                            l4 = Block.OreRedstone.BlockIndexInTexture;
                        }
                    }
                    else if (j4 == 10)
                    {
                        l4 = Block.OreIron.BlockIndexInTexture;
                    }
                    else if (j4 == 8)
                    {
                        l4 = Block.OreCoal.BlockIndexInTexture;
                    }
                    else if (j4 > 4)
                    {
                        l4 = Block.Stone.BlockIndexInTexture;
                    }
                    else if (j4 > 0)
                    {
                        l4 = Block.Dirt.BlockIndexInTexture;
                    }

                    DrawTexturedModalRect((k1 + k3 * 16) - k2, (l1 + i3 * 16) - l2, l4 % 16 << 4, (l4 >> 4) << 4, 16, 16);
                }
            }

            //GL.Enable(EnableCap.DepthTest);
            //GL.DepthFunc(DepthFunction.Lequal);
            //GL.Disable(EnableCap.Texture2D);

            for (int j3 = 0; j3 < AchievementList.Achievements.Count; j3++)
            {
                Achievement achievement1 = (Achievement)AchievementList.Achievements[j3];

                if (achievement1.ParentAchievement == null)
                {
                    continue;
                }

                int  l3    = (achievement1.DisplayColumn * 24 - i) + 11 + k1;
                int  k4    = (achievement1.DisplayRow * 24 - j) + 11 + l1;
                int  i5    = (achievement1.ParentAchievement.DisplayColumn * 24 - i) + 11 + k1;
                int  l5    = (achievement1.ParentAchievement.DisplayRow * 24 - j) + 11 + l1;
                bool flag  = statFileWriter.HasAchievementUnlocked(achievement1);
                bool flag1 = statFileWriter.CanUnlockAchievement(achievement1);
                int  c     = Math.Sin(((double)(JavaHelper.CurrentTimeMillis() % 600L) / 600D) * Math.PI * 2D) <= 0.59999999999999998D ? 202 : 377;
                long i8    = 0xff000000;

                if (flag)
                {
                    i8 = 0xff707070;
                }
                else if (flag1)
                {
                    i8 = 65280 + (c << 24);
                }

                DrawHorizontalLine(l3, i5, k4, (int)i8);
                DrawVerticalLine(i5, k4, l5, (int)i8);
            }

            Achievement achievement = null;
            RenderItem  renderitem  = new RenderItem();

            RenderHelper.EnableGUIStandardItemLighting();
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.RescaleNormal);
            //GL.Enable(EnableCap.ColorMaterial);

            for (int i4 = 0; i4 < AchievementList.Achievements.Count; i4++)
            {
                Achievement achievement2 = (Achievement)AchievementList.Achievements[i4];
                int         j5           = achievement2.DisplayColumn * 24 - i;
                int         i6           = achievement2.DisplayRow * 24 - j;

                if (j5 < -24 || i6 < -24 || j5 > 224 || i6 > 155)
                {
                    continue;
                }

                if (statFileWriter.HasAchievementUnlocked(achievement2))
                {
                    float f1 = 1.0F;
                    //GL.Color4(f1, f1, f1, 1.0F);
                }
                else if (statFileWriter.CanUnlockAchievement(achievement2))
                {
                    float f2 = Math.Sin(((double)(JavaHelper.CurrentTimeMillis() % 600L) / 600D) * Math.PI * 2D) >= 0.59999999999999998D ? 0.8F : 0.6F;
                    //GL.Color4(f2, f2, f2, 1.0F);
                }
                else
                {
                    float f3 = 0.3F;
                    //GL.Color4(f3, f3, f3, 1.0F);
                }

                Mc.RenderEngineOld.BindTexture(l);
                int k6 = k1 + j5;
                int j7 = l1 + i6;

                if (achievement2.GetSpecial())
                {
                    DrawTexturedModalRect(k6 - 2, j7 - 2, 26, 202, 26, 26);
                }
                else
                {
                    DrawTexturedModalRect(k6 - 2, j7 - 2, 0, 202, 26, 26);
                }

                if (!statFileWriter.CanUnlockAchievement(achievement2))
                {
                    float f4 = 0.1F;
                    //GL.Color4(f4, f4, f4, 1.0F);
                    renderitem.Field_27004_a = false;
                }

                //GL.Enable(EnableCap.Lighting);
                //GL.Enable(EnableCap.CullFace);
                renderitem.RenderItemIntoGUI(Mc.FontRenderer, Mc.RenderEngineOld, achievement2.TheItemStack, k6 + 3, j7 + 3);
                //GL.Disable(EnableCap.Lighting);

                if (!statFileWriter.CanUnlockAchievement(achievement2))
                {
                    renderitem.Field_27004_a = true;
                }

                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);

                if (par1 >= k1 && par2 >= l1 && par1 < k1 + 224 && par2 < l1 + 155 && par1 >= k6 && par1 <= k6 + 22 && par2 >= j7 && par2 <= j7 + 22)
                {
                    achievement = achievement2;
                }
            }

            //GL.Disable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Blend);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            Mc.RenderEngineOld.BindTexture(l);
            DrawTexturedModalRect(i1, j1, 0, 0, AchievementsPaneWidth, AchievementsPaneHeight);
            //GL.PopMatrix();
            ZLevel = 0.0F;
            //GL.DepthFunc(DepthFunction.Lequal);
            //GL.Disable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Texture2D);
            base.DrawScreen(par1, par2, par3);

            if (achievement != null)
            {
                string s  = StatCollector.TranslateToLocal(achievement.GetName());
                string s1 = achievement.GetDescription();
                int    k5 = par1 + 12;
                int    j6 = par2 - 4;

                if (statFileWriter.CanUnlockAchievement(achievement))
                {
                    int l6 = Math.Max(FontRenderer.GetStringWidth(s), 120);
                    int k7 = FontRenderer.SplitStringWidth(s1, l6);

                    if (statFileWriter.HasAchievementUnlocked(achievement))
                    {
                        k7 += 12;
                    }

                    DrawGradientRect(k5 - 3, j6 - 3, k5 + l6 + 3, j6 + k7 + 3 + 12, 0xc000000, 0xc000000);
                    FontRenderer.DrawSplitString(s1, k5, j6 + 12, l6, 0xffa0a0a);

                    if (statFileWriter.HasAchievementUnlocked(achievement))
                    {
                        FontRenderer.DrawStringWithShadow(StatCollector.TranslateToLocal("achievement.taken"), k5, j6 + k7 + 4, 0xff9090f);
                    }
                }
                else
                {
                    int    i7 = Math.Max(FontRenderer.GetStringWidth(s), 120);
                    string s2 = StatCollector.TranslateToLocalFormatted("achievement.requires", new Object[]
                    {
                        StatCollector.TranslateToLocal(achievement.ParentAchievement.GetName())
                    });
                    int l7 = FontRenderer.SplitStringWidth(s2, i7);
                    DrawGradientRect(k5 - 3, j6 - 3, k5 + i7 + 3, j6 + l7 + 12 + 3, 0xc000000, 0xc000000);
                    FontRenderer.DrawSplitString(s2, k5, j6 + 12, i7, 0xff70505);
                }

                FontRenderer.DrawStringWithShadow(s, k5, j6, statFileWriter.CanUnlockAchievement(achievement) ? achievement.GetSpecial() ? -128 : -1 : achievement.GetSpecial() ? 0xff80804 : 0xff80808);
            }

            //GL.Enable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Lighting);
            RenderHelper.DisableStandardItemLighting();
        }
 public GuiAchievement(Minecraft par1Minecraft)
 {
     TheGame    = par1Minecraft;
     ItemRender = new RenderItem();
 }