public Chunk(World par1World, int par2, int par3) { storageArrays = new ExtendedBlockStorage[16]; blockBiomeArray = new byte[256]; PrecipitationHeightMap = new int[256]; UpdateSkylightColumns = new bool[256]; isGapLightingUpdated = false; ChunkTileEntityMap = new Dictionary <ChunkPosition, TileEntity>(); IsTerrainPopulated = false; IsModified = false; HasEntities = false; LastSaveTime = 0L; Field_50120_o = false; queuedLightChecks = 4096; Field_35846_u = false; EntityLists = new List <Entity> [16]; WorldObj = par1World; XPosition = par2; ZPosition = par3; HeightMap = new int[256]; for (int i = 0; i < EntityLists.Length; i++) { EntityLists[i] = new List <Entity>(); } JavaHelper.FillArray(PrecipitationHeightMap, -999); unchecked { JavaHelper.FillArray(blockBiomeArray, (byte)-1); } }
private void UpdateTagCompound(NBTTagCompound par1NBTTagCompound, NBTTagCompound par2NBTTagCompound) { par1NBTTagCompound.SetLong("RandomSeed", RandomSeed); par1NBTTagCompound.SetString("generatorName", TerrainType.Func_48628_a()); par1NBTTagCompound.SetInteger("generatorVersion", TerrainType.GetGeneratorVersion()); par1NBTTagCompound.SetInteger("GameType", GameType); par1NBTTagCompound.Setbool("MapFeatures", MapFeaturesEnabled); par1NBTTagCompound.SetInteger("SpawnX", SpawnX); par1NBTTagCompound.SetInteger("SpawnY", SpawnY); par1NBTTagCompound.SetInteger("SpawnZ", SpawnZ); par1NBTTagCompound.SetLong("Time", WorldTime); par1NBTTagCompound.SetLong("SizeOnDisk", SizeOnDisk); par1NBTTagCompound.SetLong("LastPlayed", JavaHelper.CurrentTimeMillis()); par1NBTTagCompound.SetString("LevelName", LevelName); par1NBTTagCompound.SetInteger("version", SaveVersion); par1NBTTagCompound.SetInteger("rainTime", RainTime); par1NBTTagCompound.Setbool("raining", Raining); par1NBTTagCompound.SetInteger("thunderTime", ThunderTime); par1NBTTagCompound.Setbool("thundering", Thundering); par1NBTTagCompound.Setbool("hardcore", Hardcore); if (par2NBTTagCompound != null) { par1NBTTagCompound.SetCompoundTag("Player", par2NBTTagCompound); } }
/// <summary> /// End section /// </summary> public static void EndSection() { if (!ProfilingEnabled) { return; } long l = JavaHelper.NanoTime(); long l1 = TimestampList[TimestampList.Count - 1]; TimestampList.RemoveAt(TimestampList.Count - 1); SectionList.RemoveAt(SectionList.Count - 1); long l2 = l - l1; if (ProfilingMap.ContainsKey(ProfilingSection)) { ProfilingMap[ProfilingSection] = (long)((long?)ProfilingMap[ProfilingSection]) + l2; } else { ProfilingMap[ProfilingSection] = l2; } ProfilingSection = SectionList.Count <= 0 ? "" : (string)SectionList[SectionList.Count - 1]; if (l2 > 0x5f5e100L) { Console.WriteLine((new StringBuilder()).Append(ProfilingSection).Append(" ").Append(l2).ToString()); } }
private void Func_40266_a(int par1, int par2, int par3, int par4, int par5) { for (int i = 0; i < 2; i++) { if (i == 0) { //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One); } if (i == 1) { //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One); } float f = 0.00390625F; float f1 = 0.00390625F; float f2 = ((float)(JavaHelper.CurrentTimeMillis() % (long)(3000 + i * 1873)) / (3000F + (float)(i * 1873))) * 256F; float f3 = 0.0F; Tessellator tessellator = Tessellator.Instance; float f4 = 4F; if (i == 1) { f4 = -1F; } tessellator.StartDrawingQuads(); tessellator.AddVertexWithUV(par2 + 0, par3 + par5, ZLevel, (f2 + (float)par5 * f4) * f, (f3 + (float)par5) * f1); tessellator.AddVertexWithUV(par2 + par4, par3 + par5, ZLevel, (f2 + (float)par4 + (float)par5 * f4) * f, (f3 + (float)par5) * f1); tessellator.AddVertexWithUV(par2 + par4, par3 + 0, ZLevel, (f2 + (float)par4) * f, (f3 + 0.0F) * f1); tessellator.AddVertexWithUV(par2 + 0, par3 + 0, ZLevel, (f2 + 0.0F) * f, (f3 + 0.0F) * f1); tessellator.Draw(); } }
/// <summary> /// Queue a taken achievement to be displayed. /// </summary> public virtual void QueueTakenAchievement(Achievement par1Achievement) { AchievementGetLocalText = StatCollector.TranslateToLocal("achievement.get"); AchievementStatName = StatCollector.TranslateToLocal(par1Achievement.GetName()); AchievementTime = JavaHelper.CurrentTimeMillis(); TheAchievement = par1Achievement; HaveAchiement = false; }
/// <summary> /// Queue a information about a achievement to be displayed. /// </summary> public virtual void QueueAchievementInformation(Achievement par1Achievement) { AchievementGetLocalText = StatCollector.TranslateToLocal(par1Achievement.GetName()); AchievementStatName = par1Achievement.GetDescription(); AchievementTime = JavaHelper.CurrentTimeMillis() - 2500L; TheAchievement = par1Achievement; HaveAchiement = true; }
public LoadingScreenRenderer(Minecraft par1Minecraft) { Field_1004_a = ""; CurrentlyDisplayedText = ""; Field_1006_d = JavaHelper.CurrentTimeMillis(); Field_1005_e = false; Mc = par1Minecraft; }
/// <summary> /// Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the /// WorldChunkManager Args: oldBiomeList, x, z, width, depth /// </summary> public override BiomeGenBase[] LoadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.Length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } JavaHelper.FillArray(par1ArrayOfBiomeGenBase, 0, par4 * par5, BiomeGenerator); return(par1ArrayOfBiomeGenBase); }
/// <summary> /// Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length. /// </summary> public override float[] GetRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { if (par1ArrayOfFloat == null || par1ArrayOfFloat.Length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } JavaHelper.FillArray(par1ArrayOfFloat, 0, par4 * par5, Rainfall); return(par1ArrayOfFloat); }
/// <summary> /// Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width, length /// </summary> public override float[] GetTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { if (par1ArrayOfFloat == null || par1ArrayOfFloat.Length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } JavaHelper.FillArray(par1ArrayOfFloat, 0, par4 * par5, HellTemperature); return(par1ArrayOfFloat); }
public ChunkProviderEnd(World par1World, long par2) { Field_40395_h = JavaHelper.ReturnRectangularArray <int>(32, 32); endWorld = par1World; endRNG = new Random((int)par2); noiseGen1 = new NoiseGeneratorOctaves(endRNG, 16); noiseGen2 = new NoiseGeneratorOctaves(endRNG, 16); noiseGen3 = new NoiseGeneratorOctaves(endRNG, 8); NoiseGen4 = new NoiseGeneratorOctaves(endRNG, 10); NoiseGen5 = new NoiseGeneratorOctaves(endRNG, 16); }
/// <summary> /// Sends a data packet if there is one to send, or sends a chunk data packet if there is one and the counter is up, /// or does nothing. If it sends a packet, it sleeps for 10ms. /// </summary> private bool SendPacket() { bool flag = false; try { if (dataPackets.Count > 0 && (ChunkDataSendCounter == 0 || JavaHelper.CurrentTimeMillis() - dataPackets[0].CreationTimeMillis >= (long)ChunkDataSendCounter)) { Packet packet; lock (sendQueueLock) { packet = dataPackets[0]; dataPackets.RemoveAt(0); sendQueueByteLength -= packet.GetPacketSize() + 1; } Packet.WritePacket(packet, binaryWriter); Field_28144_e[packet.GetPacketId()] += packet.GetPacketSize() + 1; flag = true; } if (Field_20100_w-- <= 0 && chunkDataPackets.Count > 0 && (ChunkDataSendCounter == 0 || JavaHelper.CurrentTimeMillis() - chunkDataPackets[0].CreationTimeMillis >= (long)ChunkDataSendCounter)) { Packet packet1; lock (sendQueueLock) { packet1 = chunkDataPackets[0]; chunkDataPackets.RemoveAt(0); sendQueueByteLength -= packet1.GetPacketSize() + 1; } Packet.WritePacket(packet1, binaryWriter); Field_28144_e[packet1.GetPacketId()] += packet1.GetPacketSize() + 1; Field_20100_w = 0; flag = true; } } catch (Exception exception) { if (!isTerminating) { OnNetworkError(exception); } return(false); } return(flag); }
/// <summary> /// Start section /// </summary> public static void StartSection(string par0Str) { if (!ProfilingEnabled) { return; } if (ProfilingSection.Length > 0) { ProfilingSection = (new StringBuilder()).Append(ProfilingSection).Append(".").ToString(); } ProfilingSection = (new StringBuilder()).Append(ProfilingSection).Append(par0Str).ToString(); SectionList.Add(ProfilingSection); TimestampList.Add(Convert.ToInt64(JavaHelper.NanoTime())); }
/// <summary> /// Returns a biome cache block at location specified. /// </summary> public virtual BiomeCacheBlock GetBiomeCacheBlock(int par1, int par2) { par1 >>= 4; par2 >>= 4; long l = (long)par1 & 0xffffffffL | ((long)par2 & 0xffffffffL) << 32; BiomeCacheBlock biomecacheblock = (BiomeCacheBlock)CacheMap.GetValueByKey(l); if (biomecacheblock == null) { biomecacheblock = new BiomeCacheBlock(this, par1, par2); CacheMap.Add(l, biomecacheblock); Cache.Add(biomecacheblock); } biomecacheblock.LastAccessTime = JavaHelper.CurrentTimeMillis(); return(biomecacheblock); }
/// <summary> /// Draws the screen and all the components in it. /// </summary> public override void DrawScreen(int par1, int par2, float par3) { RenderSkybox(par1, par2, par3); Tessellator tessellator = Tessellator.Instance; int c = 274; int i = Width / 2 - c / 2; sbyte byte0 = 30; DrawGradientRect(0, 0, Width, Height, 0x80fffff, 0xffffff); DrawGradientRect(0, 0, Width, Height, 0, 0x8000000); //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("title.mclogo.png")); RenderEngine.Instance.BindTexture("title.mclogo.png"); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); if ((double)UpdateCounter < 0.0001D) { DrawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 99, 44); DrawTexturedModalRect(i + 99, byte0 + 0, 129, 0, 27, 44); DrawTexturedModalRect(i + 99 + 26, byte0 + 0, 126, 0, 3, 44); DrawTexturedModalRect(i + 99 + 26 + 3, byte0 + 0, 99, 0, 26, 44); DrawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44); } else { DrawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 155, 44); DrawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44); } /* * tessellator.SetColorOpaque_I(0xffffff); * GL.PushMatrix(); * GL.Translate(Width / 2 + 90, 70F, 0.0F); * GL.Rotate(-20F, 0.0F, 0.0F, 1.0F);*/ float f = 1.8F - MathHelper2.Abs(MathHelper2.Sin(((float)(JavaHelper.CurrentTimeMillis() % 1000L) / 1000F) * (float)Math.PI * 2.0F) * 0.1F); f = (f * 100F) / (float)(FontRenderer.GetStringWidth(SplashText) + 32); //GL.Scale(f, f, f); DrawCenteredString(FontRenderer, SplashText, 300, 80, 0xffff00); //GL.PopMatrix(); DrawString(FontRenderer, Minecraft.GetMinecraftTitle(), 2, Height - FontRenderer.FontHeight, 0xffffff); string s = "Copyright Mojang AB. Do not distribute!"; DrawString(FontRenderer, s, Width - (int)FontRenderer.GetStringWidth(s) - 2, Height - FontRenderer.FontHeight, 0xffffff); base.DrawScreen(par1, par2, par3); }
public ChunkProviderGenerate(World par1World, long par2, bool par4) { stoneNoise = new double[256]; caveGenerator = new MapGenCaves(); strongholdGenerator = new MapGenStronghold(); villageGenerator = new MapGenVillage(0); mineshaftGenerator = new MapGenMineshaft(); ravineGenerator = new MapGenRavine(); Field_914_i = JavaHelper.ReturnRectangularArray <int>(32, 32); worldObj = par1World; mapFeaturesEnabled = par4; rand = new Random((int)par2); noiseGen1 = new NoiseGeneratorOctaves(rand, 16); noiseGen2 = new NoiseGeneratorOctaves(rand, 16); noiseGen3 = new NoiseGeneratorOctaves(rand, 8); noiseGen4 = new NoiseGeneratorOctaves(rand, 4); NoiseGen5 = new NoiseGeneratorOctaves(rand, 10); NoiseGen6 = new NoiseGeneratorOctaves(rand, 16); MobSpawnerNoise = new NoiseGeneratorOctaves(rand, 8); }
public static void Main(string[] programArguments) { string username = (new StringBuilder()).Append("Player").Append(JavaHelper.CurrentTimeMillis() % 1000L).ToString(); string sessionID = "-"; if (programArguments.Length > 0) { username = programArguments[0]; } if (programArguments.Length > 1) { sessionID = programArguments[1]; } using (Minecraft game = new Minecraft(1024, 600, false)) { game.Session = new Session(username, sessionID); game.Run(); } }
public EntityDragon(World par1World) : base(par1World) { //ORIGINAL LINE: Field_40162_d = new double[64][3]; //JAVA TO C# CONVERTER NOTE: The following call to the 'RectangularArrays' helper class reproduces the rectangular array initialization that is automatic in Java: Field_40162_d = JavaHelper.ReturnRectangularArray <float>(64, 3); Field_40164_e = -1; Field_40173_aw = 0.0F; Field_40172_ax = 0.0F; Field_40163_ay = false; Field_40161_az = false; Field_40178_aA = 0; HealingEnderCrystal = null; DragonPartArray = (new EntityDragonPart[] { DragonPartHead = new EntityDragonPart(this, "head", 6F, 6F), DragonPartBody = new EntityDragonPart(this, "body", 8F, 8F), DragonPartTail1 = new EntityDragonPart(this, "tail", 4F, 4F), DragonPartTail2 = new EntityDragonPart(this, "tail", 4F, 4F), DragonPartTail3 = new EntityDragonPart(this, "tail", 4F, 4F), DragonPartWing1 = new EntityDragonPart(this, "wing", 4F, 4F), DragonPartWing2 = new EntityDragonPart(this, "wing", 4F, 4F) }); MaxHealth = 200; SetEntityHealth(MaxHealth); Texture = "/mob/enderdragon/ender.png"; SetSize(16F, 8F); NoClip = true; isImmuneToFire_Renamed = true; TargetY = 100; IgnoreFrustumCheck = true; }
/// <summary> /// Removes BiomeCacheBlocks from this cache that haven't been accessed in at least 30 seconds. /// </summary> public virtual void CleanupCache() { long l = JavaHelper.CurrentTimeMillis(); long l1 = l - LastCleanupTime; if (l1 > 7500L || l1 < 0L) { LastCleanupTime = l; for (int i = 0; i < Cache.Count; i++) { BiomeCacheBlock biomecacheblock = (BiomeCacheBlock)Cache[i]; long l2 = l - biomecacheblock.LastAccessTime; if (l2 > 30000L || l2 < 0L) { Cache.RemoveAt(i--); long l3 = (long)biomecacheblock.XPosition & 0xffffffffL | ((long)biomecacheblock.ZPosition & 0xffffffffL) << 32; CacheMap.Remove(l3); } } } }
/// <summary> /// Generates a list of leaf nodes for the tree, to be populated by generateLeaves. /// </summary> public virtual void GenerateLeafNodeList() { Height = (int)((double)HeightLimit * HeightAttenuation); if (Height >= HeightLimit) { Height = HeightLimit - 1; } int i = (int)(1.3819999999999999D + Math.Pow((LeafDensity * (double)HeightLimit) / 13D, 2D)); if (i < 1) { i = 1; } int[][] ai = JavaHelper.ReturnRectangularArray <int>(i * HeightLimit, 4); int j = (BasePos[1] + HeightLimit) - LeafDistanceLimit; int k = 1; int l = BasePos[1] + Height; int i1 = j - BasePos[1]; ai[0][0] = BasePos[0]; ai[0][1] = j; ai[0][2] = BasePos[2]; ai[0][3] = l; j--; while (i1 >= 0) { int j1 = 0; float f = LayerSize(i1); if (f < 0.0F) { j--; i1--; } else { double d = 0.5D; for (; j1 < i; j1++) { double d1 = ScaleWidth * ((double)f * ((double)Rand.NextFloat() + 0.32800000000000001D)); double d2 = (double)Rand.NextFloat() * 2D * Math.PI; int k1 = MathHelper2.Floor_double(d1 * Math.Sin(d2) + (double)BasePos[0] + d); int l1 = MathHelper2.Floor_double(d1 * Math.Cos(d2) + (double)BasePos[2] + d); int[] ai1 = { k1, j, l1 }; int[] ai2 = { k1, j + LeafDistanceLimit, l1 }; if (CheckBlockLine(ai1, ai2) != -1) { continue; } int[] ai3 = { BasePos[0], BasePos[1], BasePos[2] }; double d3 = Math.Sqrt(Math.Pow(Math.Abs(BasePos[0] - ai1[0]), 2D) + Math.Pow(Math.Abs(BasePos[2] - ai1[2]), 2D)); double d4 = d3 * BranchSlope; if ((double)ai1[1] - d4 > (double)l) { ai3[1] = l; } else { ai3[1] = (int)((double)ai1[1] - d4); } if (CheckBlockLine(ai3, ai1) == -1) { ai[k][0] = k1; ai[k][1] = j; ai[k][2] = l1; ai[k][3] = ai3[1]; k++; } } j--; i1--; } } LeafNodes = JavaHelper.ReturnRectangularArray <int>(k, 4); Array.Copy(ai, 0, LeafNodes, 0, k); }
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 void Write(int par1, int par2, byte[] par3ArrayOfByte, int par4) { try { int i = GetOffset(par1, par2); int j = i >> 8; int i1 = i & 0xff; int j1 = (par4 + 5) / 4096 + 1; if (j1 >= 256) { return; } if (j != 0 && i1 == j1) { Debug("SAVE", par1, par2, par4, "rewrite"); Write(j, par3ArrayOfByte, par4); } else { for (int k1 = 0; k1 < i1; k1++) { sectorFree[j + k1] = true; } int l1 = sectorFree.IndexOf(true); int i2 = 0; if (l1 != -1) { int j2 = l1; do { if (j2 >= sectorFree.Count) { break; } if (i2 != 0) { if (sectorFree[j2]) { i2++; } else { i2 = 0; } } else if (sectorFree[j2]) { l1 = j2; i2 = 1; } if (i2 >= j1) { break; } j2++; }while (true); } if (i2 >= j1) { Debug("SAVE", par1, par2, par4, "reuse"); int k = l1; SetOffset(par1, par2, k << 8 | j1); for (int k2 = 0; k2 < j1; k2++) { sectorFree[k + k2] = false; } Write(k, par3ArrayOfByte, par4); } else { Debug("SAVE", par1, par2, par4, "grow"); dataFile.Seek(dataFile.Length); int l = sectorFree.Count; for (int l2 = 0; l2 < j1; l2++) { dataFile.Write(emptySector); sectorFree.Add(false); } SizeDelta += 4096 * j1; Write(l, par3ArrayOfByte, par4); SetOffset(par1, par2, l << 8 | j1); } } SetChunkTimestamp(par1, par2, (int)(JavaHelper.CurrentTimeMillis() / 1000L)); } catch (IOException ioexception) { Utilities.LogException(ioexception); } }
/// <summary> /// Renders the item stack for being in an entity's hand Args: itemStack /// </summary> public virtual void RenderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) { //GL.PushMatrix(); if (par2ItemStack.ItemID < 256 && RenderBlocks.RenderItemIn3d(Block.BlocksList[par2ItemStack.ItemID].GetRenderType())) { //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/terrain.png")); RenderBlocksInstance.RenderBlockAsItem(Block.BlocksList[par2ItemStack.ItemID], par2ItemStack.GetItemDamage(), 1.0F); } else { if (par2ItemStack.ItemID < 256) { //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/terrain.png")); } else { //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/gui/items.png")); } Tessellator tessellator = Tessellator.Instance; int i = par1EntityLiving.GetItemIcon(par2ItemStack, par3); float f = ((float)((i % 16) * 16) + 0.0F) / 256F; float f1 = ((float)((i % 16) * 16) + 15.99F) / 256F; float f2 = ((float)((i / 16) * 16) + 0.0F) / 256F; float f3 = ((float)((i / 16) * 16) + 15.99F) / 256F; // float f4 = 0.0F; // float f5 = 0.3F; //GL.Enable(EnableCap.RescaleNormal); //GL.Translate(-f4, -f5, 0.0F); // float f6 = 1.5F; //GL.Scale(f6, f6, f6); //GL.Rotate(50F, 0.0F, 1.0F, 0.0F); //GL.Rotate(335F, 0.0F, 0.0F, 1.0F); //GL.Translate(-0.9375F, -0.0625F, 0.0F); RenderItemIn2D(tessellator, f1, f2, f, f3); if (par2ItemStack != null && par2ItemStack.HasEffect() && par3 == 0) { //GL.DepthFunc(DepthFunction.Equal); //GL.Disable(EnableCap.Lighting); Mc.RenderEngineOld.BindTexture(Mc.RenderEngineOld.GetTexture("%blur%/misc/glint.png")); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One); // float f7 = 0.76F; //GL.Color4(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); //GL.MatrixMode(MatrixMode.Texture); //GL.PushMatrix(); // float f8 = 0.125F; //GL.Scale(f8, f8, f8); float f9 = ((float)(JavaHelper.CurrentTimeMillis() % 3000L) / 3000F) * 8F; //GL.Translate(f9, 0.0F, 0.0F); //GL.Rotate(-50F, 0.0F, 0.0F, 1.0F); RenderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F); //GL.PopMatrix(); //GL.PushMatrix(); //GL.Scale(f8, f8, f8); f9 = ((float)(JavaHelper.CurrentTimeMillis() % 4873L) / 4873F) * 8F; //GL.Translate(-f9, 0.0F, 0.0F); //GL.Rotate(10F, 0.0F, 0.0F, 1.0F); RenderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F); //GL.PopMatrix(); //GL.MatrixMode(MatrixMode.Modelview); //GL.Disable(EnableCap.Blend); //GL.Enable(EnableCap.Lighting); //GL.DepthFunc(DepthFunction.Lequal); } //GL.Disable(EnableCap.RescaleNormal); } //GL.PopMatrix(); }
/// <summary> /// draws the slot to the screen, pass in mouse's current x and y and partial ticks /// </summary> public virtual void DrawScreen(int par1, int par2, float par3) { MouseX = par1; MouseY = par2; DrawBackground(); int i = GetSize(); int j = Width / 2 + 124; int k = j + 6; if (Mc.Input.Mouse.WasButtonPressed(MouseButtons.Left)) { if (InitialClickY == -1F) { bool flag = true; if (par2 >= Top && par2 <= Bottom) { int i1 = Width / 2 - 110; int j1 = Width / 2 + 110; int l1 = ((par2 - Top - Field_27261_r) + (int)AmountScrolled) - 4; int j2 = l1 / SlotHeight; if (par1 >= i1 && par1 <= j1 && j2 >= 0 && l1 >= 0 && j2 < i) { bool flag1 = j2 == SelectedElement && JavaHelper.CurrentTimeMillis() - LastClicked < 250L; ElementClicked(j2, flag1); SelectedElement = j2; LastClicked = JavaHelper.CurrentTimeMillis(); } else if (par1 >= i1 && par1 <= j1 && l1 < 0) { Func_27255_a(par1 - i1, ((par2 - Top) + (int)AmountScrolled) - 4); flag = false; } if (par1 >= j && par1 <= k) { ScrollMultiplier = -1F; int l2 = GetContentHeight() - (Bottom - Top - 4); if (l2 < 1) { l2 = 1; } int k3 = (int)((float)((Bottom - Top) * (Bottom - Top)) / (float)GetContentHeight()); if (k3 < 32) { k3 = 32; } if (k3 > Bottom - Top - 8) { k3 = Bottom - Top - 8; } ScrollMultiplier /= (float)(Bottom - Top - k3) / (float)l2; } else { ScrollMultiplier = 1.0F; } if (flag) { InitialClickY = par2; } else { InitialClickY = -2F; } } else { InitialClickY = -2F; } } else if (InitialClickY >= 0.0F) { AmountScrolled -= ((float)par2 - InitialClickY) * ScrollMultiplier; InitialClickY = par2; } } else { /* * do * { * if (!Mouse.next()) * { * break; * } */ int l = Mc.Input.Mouse.WheelDelta; if (l != 0) { if (l > 0) { l = -1; } else if (l < 0) { l = 1; } AmountScrolled += (l * SlotHeight) / 2; } /* * } * while (true);*/ InitialClickY = -1F; } BindAmountScrolled(); //GL.Disable(EnableCap.Lighting); //GL.Disable(EnableCap.Fog); Tessellator tessellator = Tessellator.Instance; //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/gui/background.png")); Mc.RenderEngine.BindTexture("gui.background.png"); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); float f = 32F; tessellator.StartDrawingQuads(); tessellator.SetColorOpaque_I(0x202020); tessellator.AddVertexWithUV(Left, Bottom, 0.0F, (float)Left / f, (float)(Bottom + (int)AmountScrolled) / f); tessellator.AddVertexWithUV(Right, Bottom, 0.0F, (float)Right / f, (float)(Bottom + (int)AmountScrolled) / f); tessellator.AddVertexWithUV(Right, Top, 0.0F, (float)Right / f, (float)(Top + (int)AmountScrolled) / f); tessellator.AddVertexWithUV(Left, Top, 0.0F, (float)Left / f, (float)(Top + (int)AmountScrolled) / f); tessellator.Draw(); int k1 = Width / 2 - 92 - 16; int i2 = (Top + 4) - (int)AmountScrolled; if (Field_27262_q) { Func_27260_a(k1, i2, tessellator); } for (int k2 = 0; k2 < i; k2++) { int i3 = i2 + k2 * SlotHeight + Field_27261_r; int l3 = SlotHeight - 4; if (i3 > Bottom || i3 + l3 < Top) { continue; } if (Field_25123_p && IsSelected(k2)) { int j4 = Width / 2 - 110; int l4 = Width / 2 + 110; //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.Disable(EnableCap.Texture2D); tessellator.StartDrawingQuads(); tessellator.SetColorOpaque_I(0x808080); tessellator.AddVertexWithUV(j4, i3 + l3 + 2, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(l4, i3 + l3 + 2, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(l4, i3 - 2, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(j4, i3 - 2, 0.0F, 0.0F, 0.0F); tessellator.SetColorOpaque_I(0); tessellator.AddVertexWithUV(j4 + 1, i3 + l3 + 1, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(l4 - 1, i3 + l3 + 1, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(l4 - 1, i3 - 1, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(j4 + 1, i3 - 1, 0.0F, 0.0F, 0.0F); tessellator.Draw(); //GL.Enable(EnableCap.Texture2D); } DrawSlot(k2, k1, i3, l3, tessellator); } //GL.Disable(EnableCap.DepthTest); sbyte byte0 = 4; OverlayBackground(0, Top, 255, 255); OverlayBackground(Bottom, Height, 255, 255); //GL.Enable(EnableCap.Blend); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); //GL.Disable(EnableCap.AlphaTest); //GL.ShadeModel(ShadingModel.Smooth); //GL.Disable(EnableCap.Texture2D); tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_I(0, 0); tessellator.AddVertexWithUV(Left, Top + byte0, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(Right, Top + byte0, 0.0F, 1.0D, 1.0D); tessellator.SetColorRGBA_I(0, 255); tessellator.AddVertexWithUV(Right, Top, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(Left, Top, 0.0F, 0.0F, 0.0F); tessellator.Draw(); tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_I(0, 255); tessellator.AddVertexWithUV(Left, Bottom, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(Right, Bottom, 0.0F, 1.0D, 1.0D); tessellator.SetColorRGBA_I(0, 0); tessellator.AddVertexWithUV(Right, Bottom - byte0, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(Left, Bottom - byte0, 0.0F, 0.0F, 0.0F); tessellator.Draw(); int j3 = GetContentHeight() - (Bottom - Top - 4); if (j3 > 0) { int i4 = ((Bottom - Top) * (Bottom - Top)) / GetContentHeight(); if (i4 < 32) { i4 = 32; } if (i4 > Bottom - Top - 8) { i4 = Bottom - Top - 8; } int k4 = ((int)AmountScrolled * (Bottom - Top - i4)) / j3 + Top; if (k4 < Top) { k4 = Top; } tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_I(0, 255); tessellator.AddVertexWithUV(j, Bottom, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(k, Bottom, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(k, Top, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(j, Top, 0.0F, 0.0F, 0.0F); tessellator.Draw(); tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_I(0x808080, 255); tessellator.AddVertexWithUV(j, k4 + i4, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(k, k4 + i4, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(k, k4, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(j, k4, 0.0F, 0.0F, 0.0F); tessellator.Draw(); tessellator.StartDrawingQuads(); tessellator.SetColorRGBA_I(0xc0c0c0, 255); tessellator.AddVertexWithUV(j, (k4 + i4) - 1, 0.0F, 0.0F, 1.0D); tessellator.AddVertexWithUV(k - 1, (k4 + i4) - 1, 0.0F, 1.0D, 1.0D); tessellator.AddVertexWithUV(k - 1, k4, 0.0F, 1.0D, 0.0F); tessellator.AddVertexWithUV(j, k4, 0.0F, 0.0F, 0.0F); tessellator.Draw(); } Func_27257_b(par1, par2); //GL.Enable(EnableCap.Texture2D); //GL.ShadeModel(ShadingModel.Flat); //GL.Enable(EnableCap.AlphaTest); //GL.Disable(EnableCap.Blend); }
/// <summary> /// Updates the small achievement tooltip window, showing a queued achievement if is needed. /// </summary> public virtual void UpdateAchievementWindow() { if (TheAchievement == null || AchievementTime == 0L) { return; } double d = (JavaHelper.CurrentTimeMillis() - AchievementTime) / 3000D; if (!HaveAchiement && (d < 0.0F || d > 1.0D)) { AchievementTime = 0L; return; } UpdateAchievementWindowScale(); //GL.Disable(EnableCap.DepthTest); //GL.DepthMask(false); double d1 = d * 2D; if (d1 > 1.0D) { d1 = 2D - d1; } d1 *= 4D; d1 = 1.0D - d1; if (d1 < 0.0F) { d1 = 0.0F; } d1 *= d1; d1 *= d1; int i = AchievementWindowWidth - 160; int j = 0 - (int)(d1 * 36D); int k = TheGame.RenderEngineOld.GetTexture("Minecraft.Resources.achievement.bg.png"); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); //GL.Enable(EnableCap.Texture2D); //GL.BindTexture(TextureTarget.Texture2D, k); //GL.Disable(EnableCap.Lighting); DrawTexturedModalRect(i, j, 96, 202, 160, 32); if (HaveAchiement) { TheGame.FontRendererOld.DrawSplitString(AchievementStatName, i + 30, j + 7, 120, -1); } else { TheGame.FontRendererOld.DrawString(AchievementGetLocalText, i + 30, j + 7, -256); TheGame.FontRendererOld.DrawString(AchievementStatName, i + 30, j + 18, -1); } RenderHelper.EnableGUIStandardItemLighting(); //GL.Disable(EnableCap.Lighting); //GL.Enable(EnableCap.RescaleNormal); //GL.Enable(EnableCap.ColorMaterial); //GL.Enable(EnableCap.Lighting); ItemRender.RenderItemIntoGUI(TheGame.FontRenderer, TheGame.RenderEngineOld, TheAchievement.TheItemStack, i + 8, j + 8); //GL.Disable(EnableCap.Lighting); //GL.DepthMask(true); //GL.Enable(EnableCap.DepthTest); }
protected override void DrawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) { ServerNBTStorage servernbtstorage = GuiMultiplayer.GetServerList(ParentGui)[par1]; lock (GuiMultiplayer.GetLock()) { if (GuiMultiplayer.GetThreadsPending() < 5 && !servernbtstorage.Polled) { servernbtstorage.Polled = true; servernbtstorage.Lag = -2L; servernbtstorage.Motd = ""; servernbtstorage.PlayerCount = ""; GuiMultiplayer.IncrementThreadsPending(); Action pollServers = () => { try { servernbtstorage.Motd = "Polling.."; long l = JavaHelper.NanoTime(); GuiMultiplayer.PollServer(ParentGui, servernbtstorage); long l1 = JavaHelper.NanoTime(); servernbtstorage.Lag = (l1 - l) / 0xf4240L; } catch (SocketException sockettimeoutexception) { Utilities.LogException(sockettimeoutexception); servernbtstorage.Lag = -1L; servernbtstorage.Motd = "Can't reach server"; } catch (IOException ioexception) { Utilities.LogException(ioexception); servernbtstorage.Lag = -1L; servernbtstorage.Motd = "Communication error"; } catch (Exception exception) { Utilities.LogException(exception); servernbtstorage.Lag = -1L; servernbtstorage.Motd = (new StringBuilder()).Append("ERROR: ").Append(exception.GetType()).ToString(); } finally { lock (GuiMultiplayer.GetLock()) { GuiMultiplayer.DecrementThreadsPending(); } } }; new Thread(new ThreadStart(pollServers)).Start(); } } ParentGui.DrawString(ParentGui.FontRenderer, servernbtstorage.Name, par2 + 2, par3 + 1, 0xffffff); ParentGui.DrawString(ParentGui.FontRenderer, servernbtstorage.Motd, par2 + 2, par3 + 12, 0x808080); ParentGui.DrawString(ParentGui.FontRenderer, servernbtstorage.PlayerCount, (par2 + 215) - (int)ParentGui.FontRenderer.GetStringWidth(servernbtstorage.PlayerCount), par3 + 12, 0x808080); ParentGui.DrawString(ParentGui.FontRenderer, servernbtstorage.Host, par2 + 2, par3 + 12 + 11, 0x303030); //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F); ParentGui.Mc.RenderEngine.BindTexture("gui.icons.png"); string s = ""; int i; int j; if (servernbtstorage.Polled && servernbtstorage.Lag != -2L) { i = 0; j = 0; if (servernbtstorage.Lag < 0L) { j = 5; } else if (servernbtstorage.Lag < 150L) { j = 0; } else if (servernbtstorage.Lag < 300L) { j = 1; } else if (servernbtstorage.Lag < 600L) { j = 2; } else if (servernbtstorage.Lag < 1000L) { j = 3; } else { j = 4; } if (servernbtstorage.Lag < 0L) { s = "(no connection)"; } else { s = (new StringBuilder()).Append(servernbtstorage.Lag).Append("ms").ToString(); } } else { i = 1; j = (int)(JavaHelper.CurrentTimeMillis() / 100L + (long)(par1 * 2) & 7L); if (j > 4) { j = 8 - j; } s = "Polling.."; } ParentGui.DrawTexturedModalRect(par2 + 205, par3, 0 + i * 10, 176 + j * 8, 10, 8); sbyte byte0 = 4; if (MouseX >= (par2 + 205) - byte0 && MouseY >= par3 - byte0 && MouseX <= par2 + 205 + 10 + byte0 && MouseY <= par3 + 8 + byte0) { GuiMultiplayer.SetTooltipText(ParentGui, s); } }
/// <summary> /// Updates the progress bar on the loading screen to the specified amount. Args: loadProgress /// </summary> public virtual void SetLoadingProgress(int par1) { if (!Mc.Running) { if (Field_1005_e) { return; } else { throw new MinecraftError(); } } long l = JavaHelper.CurrentTimeMillis(); if (l - Field_1006_d < 100L) { return; } Field_1006_d = l; ScaledResolution scaledresolution = new ScaledResolution(Mc.GameSettings, Mc.DisplayWidth, Mc.DisplayHeight); int i = scaledresolution.GetScaledWidth(); int j = scaledresolution.GetScaledHeight(); /* * GL.Clear(ClearBufferMask.ColorBufferBit); * GL.MatrixMode(MatrixMode.Projection); * GL.LoadIdentity(); * GL.Ortho(0.0F, scaledresolution.ScaledWidthD, scaledresolution.ScaledHeightD, 0.0F, 100D, 300D); * GL.MatrixMode(MatrixMode.Modelview); * GL.LoadIdentity(); * GL.Translate(0.0F, 0.0F, -200F); * GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); * Tessellator tessellator = Tessellator.Instance; * int k = Mc.RenderEngineOld.GetTexture("/gui/background.png");*/ //GL.BindTexture(TextureTarget.Texture2D, k); //Mc.RenderEngine.BindTexture("gui.background.png"); float f = 32F; /* * tessellator.StartDrawingQuads(); * tessellator.SetColorOpaque_I(0x404040); * tessellator.AddVertexWithUV(0.0F, j, 0.0F, 0.0F, (float)j / f); * tessellator.AddVertexWithUV(i, j, 0.0F, (float)i / f, (float)j / f); * tessellator.AddVertexWithUV(i, 0.0F, 0.0F, (float)i / f, 0.0F); * tessellator.AddVertexWithUV(0.0F, 0.0F, 0.0F, 0.0F, 0.0F); * tessellator.Draw(); */ //Mc.RenderEngine.RenderSprite(new Rectangle(0, 0, i, j), new Rectangle(0, 0, i, j)); if (par1 >= 0) { sbyte byte0 = 100; sbyte byte1 = 2; int i1 = i / 2 - byte0 / 2; int j1 = j / 2 + 16; /* * //GL.Disable(EnableCap.Texture2D); * tessellator.StartDrawingQuads(); * tessellator.SetColorOpaque_I(0x808080); * tessellator.AddVertex(i1, j1, 0.0F); * tessellator.AddVertex(i1, j1 + byte1, 0.0F); * tessellator.AddVertex(i1 + byte0, j1 + byte1, 0.0F); * tessellator.AddVertex(i1 + byte0, j1, 0.0F); * tessellator.SetColorOpaque_I(0x80ff80); * tessellator.AddVertex(i1, j1, 0.0F); * tessellator.AddVertex(i1, j1 + byte1, 0.0F); * tessellator.AddVertex(i1 + par1, j1 + byte1, 0.0F); * tessellator.AddVertex(i1 + par1, j1, 0.0F); * tessellator.Draw();*/ //GL.Enable(EnableCap.Texture2D); } /* * Mc.FontRenderer.DrawStringWithShadow(CurrentlyDisplayedText, (i - Mc.FontRenderer.GetStringWidth(CurrentlyDisplayedText)) / 2, j / 2 - 4 - 16, 0xffffff); * Mc.FontRenderer.DrawStringWithShadow(Field_1004_a, (i - Mc.FontRenderer.GetStringWidth(Field_1004_a)) / 2, (j / 2 - 4) + 8, 0xffffff);*/ //Display.update(); try { Thread.Yield(); } catch (Exception exception) { Utilities.LogException(exception); } }
public TexturePortalFX() : base(Block.Portal.BlockIndexInTexture) { PortalTickCounter = 0; PortalTextureData = JavaHelper.ReturnRectangularArray <sbyte>(32, 1024); Random random = new Random(100); for (int i = 0; i < 32; i++) { for (int j = 0; j < 16; j++) { for (int k = 0; k < 16; k++) { float f = 0.0F; for (int l = 0; l < 2; l++) { float f1 = (float)(l * 16) * 0.5F; float f2 = (float)(l * 16) * 0.5F; float f3 = (((float)j - f1) / 16F) * 2.0F; float f4 = (((float)k - f2) / 16F) * 2.0F; if (f3 < -1F) { f3 += 2.0F; } if (f3 >= 1.0F) { f3 -= 2.0F; } if (f4 < -1F) { f4 += 2.0F; } if (f4 >= 1.0F) { f4 -= 2.0F; } float f5 = f3 * f3 + f4 * f4; float f6 = (float)Math.Atan2(f4, f3) + ((((float)i / 32F) * (float)Math.PI * 2.0F - f5 * 10F) + (float)(l * 2)) * (float)(l * 2 - 1); f6 = (MathHelper2.Sin(f6) + 1.0F) / 2.0F; f6 /= f5 + 1.0F; f += f6 * 0.5F; } f += random.NextFloat() * 0.1F; int i1 = (int)(f * 100F + 155F); int j1 = (int)(f * f * 200F + 55F); int k1 = (int)(f * f * f * f * 255F); int l1 = (int)(f * 100F + 155F); int i2 = k * 16 + j; PortalTextureData[i][i2 * 4 + 0] = (sbyte)j1; PortalTextureData[i][i2 * 4 + 1] = (sbyte)k1; PortalTextureData[i][i2 * 4 + 2] = (sbyte)i1; PortalTextureData[i][i2 * 4 + 3] = (sbyte)l1; } } } }
public virtual void Render(IsoImageBuffer par1IsoImageBuffer) { World world = par1IsoImageBuffer.Level; if (world == null) { par1IsoImageBuffer.NoContent = true; par1IsoImageBuffer.Rendered = true; return; } int i = par1IsoImageBuffer.x * 16; int j = par1IsoImageBuffer.y * 16; int k = i + 16; int l = j + 16; Chunk chunk = world.GetChunkFromChunkCoords(par1IsoImageBuffer.x, par1IsoImageBuffer.y); if (chunk.IsEmpty()) { par1IsoImageBuffer.NoContent = true; par1IsoImageBuffer.Rendered = true; return; } par1IsoImageBuffer.NoContent = false; JavaHelper.FillArray(ZBuf, 0); JavaHelper.FillArray(WaterBuf, 0); JavaHelper.FillArray(YBuf, 544); for (int i1 = l - 1; i1 >= j; i1--) { for (int j1 = k - 1; j1 >= i; j1--) { int k1 = j1 - i; int l1 = i1 - j; int i2 = k1 + l1; bool flag = true; for (int j2 = 0; j2 < 128; j2++) { int k2 = ((l1 - k1 - j2) + 544) - 16; if (k2 >= YBuf[i2] && k2 >= YBuf[i2 + 1]) { continue; } Block block = Block.BlocksList[world.GetBlockId(j1, j2, i1)]; if (block == null) { flag = false; continue; } if (block.BlockMaterial == Material.Water) { int l2 = world.GetBlockId(j1, j2 + 1, i1); if (l2 != 0 && Block.BlocksList[l2].BlockMaterial == Material.Water) { continue; } float f1 = ((float)j2 / 127F) * 0.6F + 0.4F; float f2 = world.GetLightBrightness(j1, j2 + 1, i1) * f1; if (k2 < 0 || k2 >= 544) { continue; } int i4 = i2 + k2 * 32; if (i2 >= 0 && i2 <= 32 && WaterBuf[i4] <= j2) { WaterBuf[i4] = j2; WaterBr[i4] = (int)(f2 * 127F); } if (i2 >= -1 && i2 <= 31 && WaterBuf[i4 + 1] <= j2) { WaterBuf[i4 + 1] = j2; WaterBr[i4 + 1] = (int)(f2 * 127F); } flag = false; continue; } if (flag) { if (k2 < YBuf[i2]) { YBuf[i2] = k2; } if (k2 < YBuf[i2 + 1]) { YBuf[i2 + 1] = k2; } } float f = ((float)j2 / 127F) * 0.6F + 0.4F; if (k2 >= 0 && k2 < 544) { int i3 = i2 + k2 * 32; int k3 = Textures[block.BlockID * 3 + 0]; float f3 = (world.GetLightBrightness(j1, j2 + 1, i1) * 0.8F + 0.2F) * f; int j4 = k3; if (i2 >= 0) { float f5 = f3; if (ZBuf[i3] <= j2) { ZBuf[i3] = j2; Pixels[i3] = 0xff00000 | (int)(TexCols[j4 * 3 + 0] * f5) << 16 | (int)(TexCols[j4 * 3 + 1] * f5) << 8 | (int)(TexCols[j4 * 3 + 2] * f5); } } if (i2 < 31) { float f6 = f3 * 0.9F; if (ZBuf[i3 + 1] <= j2) { ZBuf[i3 + 1] = j2; Pixels[i3 + 1] = 0xff00000 | (int)(TexCols[j4 * 3 + 0] * f6) << 16 | (int)(TexCols[j4 * 3 + 1] * f6) << 8 | (int)(TexCols[j4 * 3 + 2] * f6); } } } if (k2 < -1 || k2 >= 543) { continue; } int j3 = i2 + (k2 + 1) * 32; int l3 = Textures[block.BlockID * 3 + 1]; float f4 = world.GetLightBrightness(j1 - 1, j2, i1) * 0.8F + 0.2F; int k4 = Textures[block.BlockID * 3 + 2]; float f7 = world.GetLightBrightness(j1, j2, i1 + 1) * 0.8F + 0.2F; if (i2 >= 0) { float f8 = f4 * f * 0.6F; if (ZBuf[j3] <= j2 - 1) { ZBuf[j3] = j2 - 1; Pixels[j3] = 0xff00000 | (int)(TexCols[l3 * 3 + 0] * f8) << 16 | (int)(TexCols[l3 * 3 + 1] * f8) << 8 | (int)(TexCols[l3 * 3 + 2] * f8); } } if (i2 >= 31) { continue; } float f9 = f7 * 0.9F * f * 0.4F; if (ZBuf[j3 + 1] <= j2 - 1) { ZBuf[j3 + 1] = j2 - 1; Pixels[j3 + 1] = 0xff00000 | (int)(TexCols[k4 * 3 + 0] * f9) << 16 | (int)(TexCols[k4 * 3 + 1] * f9) << 8 | (int)(TexCols[k4 * 3 + 2] * f9); } } } } PostProcess(); if (par1IsoImageBuffer.Image == null) { par1IsoImageBuffer.Image = new Bitmap(32, 544); } //par1IsoImageBuffer.Image.setRGB(0, 0, 32, 544, Pixels, 0, 32); par1IsoImageBuffer.Rendered = true; }