Program: 40662
Project: 40662
Buggy source:
@SubscribeEvent @SuppressWarnings("String_Node_Str") public void onTextureStitchPre(TextureStitchEvent.Pre event){
  ModelLoader loader;
  Map<ModelResourceLocation,IModel> secretSauce=null;
  BlockModelShapes blockModelShapes=null;
  try {
    Class c=Class.forName("String_Node_Str");
    Field f=c.getDeclaredField("String_Node_Str");
    f.setAccessible(true);
    Object o=f.get(null);
    f=c.getDeclaredField("String_Node_Str");
    f.setAccessible(true);
    loader=(ModelLoader)f.get(o);
    f=ModelLoader.class.getDeclaredField("String_Node_Str");
    f.setAccessible(true);
    secretSauce=(Map<ModelResourceLocation,IModel>)f.get(loader);
    f=ReflectionHelper.findField(ModelBakery.class,"String_Node_Str","String_Node_Str");
    f.setAccessible(true);
    blockModelShapes=(BlockModelShapes)f.get(loader);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  UnlimitedChiselWorks.proxy.progressPush("String_Node_Str",UnlimitedChiselWorks.BLOCK_RULES.size());
  int cc=0;
  for (  UCWBlockRule rule : UnlimitedChiselWorks.BLOCK_RULES) {
    UnlimitedChiselWorks.proxy.progressStep(String.format("String_Node_Str",(++cc) * 100 / UnlimitedChiselWorks.BLOCK_RULES.size()));
    Map<IBlockState,ModelResourceLocation> fromVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.fromBlock);
    Map<IBlockState,ModelResourceLocation> overlayVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.overlayBlock);
    Map<IBlockState,ModelResourceLocation> throughVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.throughBlock);
    Map<IBlockState,ModelResourceLocation> basedUponVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.basedUponBlock);
    for (int i=0; i < rule.from.size(); i++) {
      if (rule.from.get(i) != null) {
        IBlockState state=rule.from.get(i);
        String s2=rule.fromBlock.getRegistryName().toString().trim().replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + state.getBlock().getMetaFromState(state);
        IBlockState stateOverlay=rule.overlay.get(i);
        IModel modelFrom=secretSauce.get(fromVariants.get(state));
        IModel modelOverlay=secretSauce.get(overlayVariants.get(stateOverlay));
        IBlockState stateBasedUpon=rule.basedUpon.size() == 1 ? rule.basedUpon.get(0) : rule.basedUpon.get(i);
        IModel modelBasedUpon=secretSauce.get(basedUponVariants.get(stateBasedUpon));
        ResourceLocation textureFrom=UCWMagic.getLocation(state,fromVariants.get(state),modelFrom);
        ResourceLocation textureOverlay=UCWMagic.getLocation(stateOverlay,overlayVariants.get(stateOverlay),modelOverlay);
        ResourceLocation textureBasedUpon=UCWMagic.getLocation(stateBasedUpon,basedUponVariants.get(stateBasedUpon),modelBasedUpon);
        for (int j=0; j < 16; j++) {
          IBlockState throughState=rule.through.get(j);
          if (throughState == null)           continue;
          ModelResourceLocation throughLoc=throughVariants.get(throughState);
          IModel modelThrough=secretSauce.get(throughLoc);
          ImmutableMap.Builder<String,String> textureRemapMap=ImmutableMap.builder();
          for (          ResourceLocation oldLocation : modelThrough.getTextures()) {
            ResourceLocation newLocation=new ResourceLocation("String_Node_Str","String_Node_Str" + s2 + "String_Node_Str"+ oldLocation.getResourceDomain()+ "String_Node_Str"+ oldLocation.getResourcePath().substring(7));
            textureRemapMap.put(oldLocation.toString(),newLocation.toString());
            event.getMap().setTextureEntry(new TextureAtlasSprite(newLocation.toString()){
              @Override public boolean hasCustomLoader(              IResourceManager manager,              ResourceLocation location){
                return true;
              }
              @Override public boolean load(              IResourceManager manager,              ResourceLocation location,              Function<ResourceLocation,TextureAtlasSprite> textureGetter){
                TextureAtlasSprite fromTex=textureGetter.apply(textureFrom);
                TextureAtlasSprite overlayTex=textureGetter.apply(textureOverlay);
                TextureAtlasSprite basedUponTex=textureGetter.apply(textureBasedUpon);
                TextureAtlasSprite locationTex=textureGetter.apply(oldLocation);
                setIconWidth(locationTex.getIconWidth());
                setIconHeight(locationTex.getIconHeight());
                clearFramesTextureData();
                for (int i=0; i < locationTex.getFrameCount(); i++) {
                  int[][] pixels=new int[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1][];
                  pixels[0]=UCWMagic.transform(locationTex,i,fromTex,overlayTex,basedUponTex,rule.mode);
                  framesTextureData.add(pixels);
                }
                return false;
              }
              @Override public java.util.Collection<ResourceLocation> getDependencies(){
                return ImmutableList.of(textureFrom,textureBasedUpon,oldLocation,textureOverlay);
              }
            }
);
          }
          UCWObjectFactory factory=rule.objectFactories.get(i);
          List<String> propertyNames=new ArrayList<>();
          for (          IProperty property : factory.block.getBlockState().getProperties()) {
            propertyNames.add(property.getName());
          }
          IBlockState targetState=factory.block.getStateFromMeta(j);
          Collections.sort(propertyNames);
          String variant="String_Node_Str";
          for (          String s : propertyNames) {
            if (variant.length() > 0)             variant+="String_Node_Str";
            IProperty property=factory.block.getBlockState().getProperty(s);
            variant+=s + "String_Node_Str" + property.getName(targetState.getValue(property));
          }
          ModelResourceLocation targetLoc=new ModelResourceLocation(factory.block.getRegistryName(),variant);
          ModelLoader.setCustomModelResourceLocation(factory.item,j,targetLoc);
          if (throughLoc.getResourceDomain().equals("String_Node_Str")) {
            try {
              if (chiselCache == null) {
                InputStream stream=Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("String_Node_Str","String_Node_Str")).getInputStream();
                InputStreamReader reader=new InputStreamReader(stream);
                chiselCache=JsonUtils.fromJson(UnlimitedChiselWorks.GSON,reader,JsonObject.class);
                reader.close();
                stream.close();
              }
              JsonObject variants=chiselCache.get("String_Node_Str").getAsJsonObject();
              if (variants.has(throughLoc.getVariant())) {
                String modelPath=variants.get(throughLoc.getVariant()).getAsJsonObject().get("String_Node_Str").getAsString();
                modelPath=modelPath.replaceFirst("String_Node_Str","String_Node_Str" + s2 + "String_Node_Str");
                secretSauce.put(targetLoc,ModelLoaderRegistry.getModel(new ModelResourceLocation(modelPath)));
              }
            }
 catch (            Exception e) {
              e.printStackTrace();
            }
          }
 else {
            secretSauce.put(targetLoc,modelThrough.retexture(textureRemapMap.build()));
          }
        }
      }
    }
  }
  UnlimitedChiselWorks.proxy.progressPop();
}

Fixed version (ground truth):
@SubscribeEvent @SuppressWarnings("String_Node_Str") public void onTextureStitchPre(TextureStitchEvent.Pre event){
  ModelLoader loader;
  Map<ModelResourceLocation,IModel> secretSauce=null;
  BlockModelShapes blockModelShapes=null;
  try {
    Class c=Class.forName("String_Node_Str");
    Field f=c.getDeclaredField("String_Node_Str");
    f.setAccessible(true);
    Object o=f.get(null);
    f=c.getDeclaredField("String_Node_Str");
    f.setAccessible(true);
    loader=(ModelLoader)f.get(o);
    f=ModelLoader.class.getDeclaredField("String_Node_Str");
    f.setAccessible(true);
    secretSauce=(Map<ModelResourceLocation,IModel>)f.get(loader);
    f=ReflectionHelper.findField(ModelBakery.class,"String_Node_Str","String_Node_Str");
    f.setAccessible(true);
    blockModelShapes=(BlockModelShapes)f.get(loader);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  UnlimitedChiselWorks.proxy.progressPush("String_Node_Str",UnlimitedChiselWorks.BLOCK_RULES.size());
  int cc=0;
  for (  UCWBlockRule rule : UnlimitedChiselWorks.BLOCK_RULES) {
    UnlimitedChiselWorks.proxy.progressStep(String.format("String_Node_Str",(++cc) * 100 / UnlimitedChiselWorks.BLOCK_RULES.size()));
    Map<IBlockState,ModelResourceLocation> fromVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.fromBlock);
    Map<IBlockState,ModelResourceLocation> overlayVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.overlayBlock);
    Map<IBlockState,ModelResourceLocation> throughVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.throughBlock);
    Map<IBlockState,ModelResourceLocation> basedUponVariants=blockModelShapes.getBlockStateMapper().getVariants(rule.basedUponBlock);
    for (int i=0; i < rule.from.size(); i++) {
      if (rule.from.get(i) != null) {
        IBlockState state=rule.from.get(i);
        String s2=rule.fromBlock.getRegistryName().toString().trim().replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str" + state.getBlock().getMetaFromState(state);
        IBlockState stateOverlay=rule.overlay.get(i);
        IModel modelFrom=secretSauce.get(fromVariants.get(state));
        IModel modelOverlay=secretSauce.get(overlayVariants.get(stateOverlay));
        IBlockState stateBasedUpon=rule.basedUpon.size() == 1 ? rule.basedUpon.get(0) : rule.basedUpon.get(i);
        IModel modelBasedUpon=secretSauce.get(basedUponVariants.get(stateBasedUpon));
        ResourceLocation textureFrom=UCWMagic.getLocation(state,fromVariants.get(state),modelFrom);
        ResourceLocation textureOverlay=UCWMagic.getLocation(stateOverlay,overlayVariants.get(stateOverlay),modelOverlay);
        ResourceLocation textureBasedUpon=UCWMagic.getLocation(stateBasedUpon,basedUponVariants.get(stateBasedUpon),modelBasedUpon);
        for (int j=0; j < 16; j++) {
          IBlockState throughState=rule.through.get(j);
          if (throughState == null)           continue;
          ModelResourceLocation throughLoc=throughVariants.get(throughState);
          IModel modelThrough=secretSauce.get(throughLoc);
          ImmutableMap.Builder<String,String> textureRemapMap=ImmutableMap.builder();
          for (          ResourceLocation oldLocation : modelThrough.getTextures()) {
            ResourceLocation newLocation=new ResourceLocation("String_Node_Str","String_Node_Str" + s2 + "String_Node_Str"+ oldLocation.getResourceDomain()+ "String_Node_Str"+ oldLocation.getResourcePath().substring(7));
            textureRemapMap.put(oldLocation.toString(),newLocation.toString());
            event.getMap().setTextureEntry(new TextureAtlasSprite(newLocation.toString()){
              @Override public boolean hasCustomLoader(              IResourceManager manager,              ResourceLocation location){
                return true;
              }
              @Override public boolean load(              IResourceManager manager,              ResourceLocation location,              Function<ResourceLocation,TextureAtlasSprite> textureGetter){
                TextureAtlasSprite fromTex=textureGetter.apply(textureFrom);
                TextureAtlasSprite overlayTex=textureGetter.apply(textureOverlay);
                TextureAtlasSprite basedUponTex=textureGetter.apply(textureBasedUpon);
                TextureAtlasSprite locationTex=textureGetter.apply(oldLocation);
                setIconWidth(locationTex.getIconWidth());
                setIconHeight(locationTex.getIconHeight());
                clearFramesTextureData();
                for (int i=0; i < locationTex.getFrameCount(); i++) {
                  int[][] pixels=new int[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1][];
                  pixels[0]=UCWMagic.transform(locationTex,i,fromTex,overlayTex,basedUponTex,rule.mode);
                  framesTextureData.add(pixels);
                }
                return false;
              }
              @Override public java.util.Collection<ResourceLocation> getDependencies(){
                return ImmutableList.of(textureFrom,textureBasedUpon,oldLocation,textureOverlay);
              }
            }
);
          }
          UCWObjectFactory factory=rule.objectFactories.get(i);
          List<String> propertyNames=new ArrayList<>();
          for (          IProperty property : factory.block.getBlockState().getProperties()) {
            propertyNames.add(property.getName());
          }
          IBlockState targetState=factory.block.getStateFromMeta(j);
          Collections.sort(propertyNames);
          StringBuilder variant=new StringBuilder();
          for (          String s : propertyNames) {
            if (variant.length() > 0)             variant.append("String_Node_Str");
            IProperty property=factory.block.getBlockState().getProperty(s);
            variant.append(s).append("String_Node_Str").append(property.getName(targetState.getValue(property)));
          }
          ModelResourceLocation targetLoc=new ModelResourceLocation(factory.block.getRegistryName(),variant.toString());
          ModelLoader.setCustomModelResourceLocation(factory.item,j,targetLoc);
          if (throughLoc.getResourceDomain().equals("String_Node_Str")) {
            try {
              if (chiselCache == null) {
                InputStream stream=Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("String_Node_Str","String_Node_Str")).getInputStream();
                InputStreamReader reader=new InputStreamReader(stream);
                chiselCache=JsonUtils.fromJson(UnlimitedChiselWorks.GSON,reader,JsonObject.class);
                reader.close();
                stream.close();
              }
              JsonObject variants=chiselCache.get("String_Node_Str").getAsJsonObject();
              if (variants.has(throughLoc.getVariant())) {
                String modelPath=variants.get(throughLoc.getVariant()).getAsJsonObject().get("String_Node_Str").getAsString();
                modelPath=modelPath.replaceFirst("String_Node_Str","String_Node_Str" + s2 + "String_Node_Str");
                secretSauce.put(targetLoc,ModelLoaderRegistry.getModel(new ModelResourceLocation(modelPath)));
              }
            }
 catch (            Exception e) {
              e.printStackTrace();
            }
          }
 else {
            secretSauce.put(targetLoc,modelThrough.retexture(textureRemapMap.build()));
          }
        }
      }
    }
  }
  UnlimitedChiselWorks.proxy.progressPop();
}