<commit_before>--- ../src-base/minecraft/net/minecraft/src/RenderEngine.java	0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/RenderEngine.java	0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,8 @@
 package net.minecraft.src;
 
+import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
+import static org.lwjgl.opengl.GL11.GL_TEXTURE_WIDTH;
+
 import java.awt.Color;
 import java.awt.Graphics;
 import java.awt.image.BufferedImage;
@@ -13,9 +16,15 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+
 import javax.imageio.ImageIO;
+
 import org.lwjgl.opengl.GL11;
 
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+
 public class RenderEngine
 {
     public static boolean field_1609_a = false;
@@ -24,7 +33,7 @@
     private IntHashMap field_1607_c = new IntHashMap();
     private IntBuffer field_1606_d = GLAllocation.func_1125_c(1);
     private ByteBuffer field_1605_e = GLAllocation.func_1127_b(16777216);
-    private List field_1604_f = new ArrayList();
+    List field_1604_f = new ArrayList();
     private Map field_1603_g = new HashMap();
     private GameSettings field_1602_h;
     public boolean field_4281_i = false;
@@ -97,6 +106,7 @@
             }
             catch (IOException var5)
             {
+                FMLCommonHandler.instance().getFMLLogger().log(Level.INFO,String.format("An error occured reading texture file %s (getTexture)", p_28149_1_),var5);
                 var5.printStackTrace();
                 int[] var4 = this.func_28148_b(this.field_25189_l);
                 this.field_28151_c.put(p_28149_1_, var4);
@@ -459,8 +469,17 @@
         for (int var2 = 0; var2 < this.field_1604_f.size(); ++var2)
         {
             TextureFX var3 = (TextureFX)this.field_1604_f.get(var2);
+            if (var3.errored) continue;
             var3.field_1131_c = this.field_1602_h.field_1578_g;
-            var3.func_783_a();
+            Profiler.func_40663_a(var3.getClass().getSimpleName());
+            try {
+                var3.func_783_a();
+            } catch (Exception e) {
+                FMLCommonHandler.instance().getFMLLogger().warning(String.format("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to",var3.getClass().getSimpleName()));
+                var3.errored=true;
+                continue;
+            }
+            Profiler.func_40662_b();
             this.field_1605_e.clear();
             this.field_1605_e.put(var3.field_1127_a);
             this.field_1605_e.position(0).limit(var3.field_1127_a.length);
@@ -470,12 +489,17 @@
                 var3.func_782_a(this);
                 var1 = var3.field_1126_b;
             }
+            if (var3.field_1127_a.length!=TextureFX.tileSizeSquare<<2) {
+                FMLCommonHandler.instance().getFMLLogger().warning(String.format("Detected a texture FX discrepancy in %s (%d, %d)",var3.getClass().getSimpleName(), var3.field_1127_a.length, var3.tileSizeSquare<<2));
+                var3.errored=true;
+                continue;
+            }
 
             for (int var4 = 0; var4 < var3.field_1129_e; ++var4)
             {
                 for (int var5 = 0; var5 < var3.field_1129_e; ++var5)
                 {
-                    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var3.field_1126_b % 16 * 16 + var4 * 16, var3.field_1126_b / 16 * 16 + var5 * 16, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.field_1605_e);
+                    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var3.field_1126_b % 16 * TextureFX.iconTileSize + var4 * TextureFX.iconTileSize, var3.field_1126_b / 16 * TextureFX.iconTileSize + var5 * TextureFX.iconTileSize, TextureFX.iconTileSize, TextureFX.iconTileSize, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.field_1605_e);
                 }
             }
         }
@@ -579,6 +603,7 @@
             }
             catch (IOException var7)
             {
+                FMLCommonHandler.instance().getFMLLogger().log(Level.INFO,String.format("An error occured reading texture file %s (refreshTexture)", var9),var7);
                 var7.printStackTrace();
             }
         }
@@ -616,9 +641,28 @@
             }
             catch (IOException var6)
             {
+                FMLCommonHandler.instance().getFMLLogger().log(Level.INFO,String.format("An error occured reading texture file data %s (refreshTexture)", var9),var6);
                 var6.printStackTrace();
             }
         }
+        GL11.glBindTexture(GL11.GL_TEXTURE_2D, func_1070_a("/terrain.png"));
+        int tileSize = GL11.glGetTexLevelParameteri(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH ) >> 4;
+        int tileSizeSquare = tileSize*tileSize;
+        int tileSizeMask = tileSize - 1;
+        int tileSizeSquareMask = tileSizeSquare - 1;
+        
+        FMLClientHandler.instance().pruneOldTextureFX(var1, tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+        
+        TextureFX.iconTileSize = tileSize;
+        TextureFX.tileSizeSquare = tileSizeSquare;
+        TextureFX.tileSizeMask = tileSizeMask;
+        TextureFX.tileSizeSquareMask = tileSizeSquareMask;
+
+        for (Object tex : field_1604_f) {
+            ((TextureFX)tex).onTexturePackChange(tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+        }
+        
+        FMLClientHandler.instance().loadTextures(var1);
     }
 
     private BufferedImage func_6526_a(InputStream p_6526_1_) throws IOException
<commit_msg>Missed a patch *sigh*<commit_after>--- ../src-base/minecraft/net/minecraft/src/RenderEngine.java	0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/RenderEngine.java	0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,8 @@
 package net.minecraft.src;
 
+import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
+import static org.lwjgl.opengl.GL11.GL_TEXTURE_WIDTH;
+
 import java.awt.Color;
 import java.awt.Graphics;
 import java.awt.image.BufferedImage;
@@ -13,9 +16,15 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+
 import javax.imageio.ImageIO;
+
 import org.lwjgl.opengl.GL11;
 
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+
 public class RenderEngine
 {
     public static boolean field_1609_a = false;
@@ -24,7 +33,7 @@
     private IntHashMap field_1607_c = new IntHashMap();
     private IntBuffer field_1606_d = GLAllocation.func_1125_c(1);
     private ByteBuffer field_1605_e = GLAllocation.func_1127_b(16777216);
-    private List field_1604_f = new ArrayList();
+    List field_1604_f = new ArrayList();
     private Map field_1603_g = new HashMap();
     private GameSettings field_1602_h;
     public boolean field_4281_i = false;
@@ -97,6 +106,7 @@
             }
             catch (IOException var5)
             {
+                FMLCommonHandler.instance().getFMLLogger().log(Level.INFO,String.format("An error occured reading texture file %s (getTexture)", p_28149_1_),var5);
                 var5.printStackTrace();
                 int[] var4 = this.func_28148_b(this.field_25189_l);
                 this.field_28151_c.put(p_28149_1_, var4);
@@ -459,8 +469,17 @@
         for (int var2 = 0; var2 < this.field_1604_f.size(); ++var2)
         {
             TextureFX var3 = (TextureFX)this.field_1604_f.get(var2);
+            if (var3.errored) continue;
             var3.field_1131_c = this.field_1602_h.field_1578_g;
-            var3.func_783_a();
+            Profiler.func_40663_a(var3.getClass().getSimpleName());
+            try {
+                var3.func_783_a();
+            } catch (Exception e) {
+                FMLCommonHandler.instance().getFMLLogger().warning(String.format("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to",var3.getClass().getSimpleName()));
+                var3.errored=true;
+                continue;
+            }
+            Profiler.func_40662_b();
             this.field_1605_e.clear();
             this.field_1605_e.put(var3.field_1127_a);
             this.field_1605_e.position(0).limit(var3.field_1127_a.length);
@@ -470,12 +489,17 @@
                 var3.func_782_a(this);
                 var1 = var3.field_1126_b;
             }
+            if (var3.field_1127_a.length!=TextureFX.tileSizeSquare<<2) {
+                FMLCommonHandler.instance().getFMLLogger().warning(String.format("Detected a texture FX discrepancy in %s (%d, %d)",var3.getClass().getSimpleName(), var3.field_1127_a.length, var3.tileSizeSquare<<2));
+                var3.errored=true;
+                continue;
+            }
 
             for (int var4 = 0; var4 < var3.field_1129_e; ++var4)
             {
                 for (int var5 = 0; var5 < var3.field_1129_e; ++var5)
                 {
-                    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var3.field_1126_b % 16 * 16 + var4 * 16, var3.field_1126_b / 16 * 16 + var5 * 16, 16, 16, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.field_1605_e);
+                    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, var3.field_1126_b % 16 * TextureFX.iconTileSize + var4 * TextureFX.iconTileSize, var3.field_1126_b / 16 * TextureFX.iconTileSize + var5 * TextureFX.iconTileSize, TextureFX.iconTileSize, TextureFX.iconTileSize, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.field_1605_e);
                 }
             }
         }
@@ -577,8 +601,9 @@
                 this.field_4280_j = false;
                 this.field_4281_i = false;
             }
-            catch (IOException var7)
+            catch (Exception var7)
             {
+                FMLCommonHandler.instance().getFMLLogger().log(Level.INFO,String.format("An error occured reading texture file %s (refreshTexture)", var9),var7);
                 var7.printStackTrace();
             }
         }
@@ -616,9 +641,28 @@
             }
             catch (IOException var6)
             {
+                FMLCommonHandler.instance().getFMLLogger().log(Level.INFO,String.format("An error occured reading texture file data %s (refreshTexture)", var9),var6);
                 var6.printStackTrace();
             }
         }
+        GL11.glBindTexture(GL11.GL_TEXTURE_2D, func_1070_a("/terrain.png"));
+        int tileSize = GL11.glGetTexLevelParameteri(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH ) >> 4;
+        int tileSizeSquare = tileSize*tileSize;
+        int tileSizeMask = tileSize - 1;
+        int tileSizeSquareMask = tileSizeSquare - 1;
+        
+        FMLClientHandler.instance().pruneOldTextureFX(var1, tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+        
+        TextureFX.iconTileSize = tileSize;
+        TextureFX.tileSizeSquare = tileSizeSquare;
+        TextureFX.tileSizeMask = tileSizeMask;
+        TextureFX.tileSizeSquareMask = tileSizeSquareMask;
+
+        for (Object tex : field_1604_f) {
+            ((TextureFX)tex).onTexturePackChange(tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+        }
+        
+        FMLClientHandler.instance().loadTextures(var1);
     }
 
     private BufferedImage func_6526_a(InputStream p_6526_1_) throws IOException

{'fraction_non_alphanumeric': 0.12053967690395881, 'fraction_numerical': 0.07784484289011184, 'mean_word_length': 2.476396174020364, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5526538', 'n_tokens_mistral': 4270, 'n_tokens_neox': 3776, 'n_words': 618}