Fix localizations not loading correctly in legacy resource packs.
This commit is contained in:
parent
41916ae39a
commit
f8cba13b5b
4 changed files with 18 additions and 4 deletions
|
@ -13,7 +13,7 @@
|
|||
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
|
||||
this.field_110451_am.func_110542_a(this.field_135017_as);
|
||||
- this.func_110436_a();
|
||||
+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
|
||||
+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am, this.field_110452_an);
|
||||
this.field_71446_o = new TextureManager(this.field_110451_am);
|
||||
this.field_110451_am.func_110542_a(this.field_71446_o);
|
||||
- this.func_180510_a(this.field_71446_o);
|
||||
|
|
|
@ -52,7 +52,10 @@ import net.minecraft.client.resources.AbstractResourcePack;
|
|||
import net.minecraft.client.resources.FallbackResourceManager;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.client.resources.LegacyV2Adapter;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||
import net.minecraft.client.resources.data.PackMetadataSection;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
|
@ -181,6 +184,8 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
|
||||
private List<IResourcePack> resourcePackList;
|
||||
|
||||
private MetadataSerializer metaSerializer;
|
||||
|
||||
private Map<String, IResourcePack> resourcePackMap;
|
||||
|
||||
private BiMap<ModContainer, IModGuiFactory> guiFactories;
|
||||
|
@ -198,12 +203,13 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
* @param resourceManager The resource manager
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void beginMinecraftLoading(Minecraft minecraft, List<IResourcePack> resourcePackList, IReloadableResourceManager resourceManager)
|
||||
public void beginMinecraftLoading(Minecraft minecraft, List<IResourcePack> resourcePackList, IReloadableResourceManager resourceManager, MetadataSerializer metaSerializer)
|
||||
{
|
||||
detectOptifine();
|
||||
SplashProgress.start();
|
||||
client = minecraft;
|
||||
this.resourcePackList = resourcePackList;
|
||||
this.metaSerializer = metaSerializer;
|
||||
this.resourcePackMap = Maps.newHashMap();
|
||||
if (minecraft.isDemo())
|
||||
{
|
||||
|
@ -623,6 +629,14 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
try
|
||||
{
|
||||
IResourcePack pack = (IResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container);
|
||||
|
||||
PackMetadataSection meta = (PackMetadataSection)pack.getPackMetadata(this.metaSerializer, "pack");
|
||||
|
||||
if (meta != null && meta.getPackFormat() == 2)
|
||||
{
|
||||
pack = new LegacyV2Adapter(pack);
|
||||
}
|
||||
|
||||
resourcePackList.add(pack);
|
||||
resourcePackMap.put(container.getModId(), pack);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class FMLFileResourcePack extends FileResourcePack implements FMLContaine
|
|||
return new ByteArrayInputStream(("{\n" +
|
||||
" \"pack\": {\n"+
|
||||
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
|
||||
" \"pack_format\": 1\n"+
|
||||
" \"pack_format\": 2\n"+
|
||||
"}\n" +
|
||||
"}").getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class FMLFolderResourcePack extends FolderResourcePack implements FMLCont
|
|||
return new ByteArrayInputStream(("{\n" +
|
||||
" \"pack\": {\n"+
|
||||
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
|
||||
" \"pack_format\": 1\n"+
|
||||
" \"pack_format\": 2\n"+
|
||||
"}\n" +
|
||||
"}").getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue