Mods are now loaded as resource packs. Vanilla will scan for valid prefixes based on subdirs of 'assets' which
can then be referenced as ResourceLocations with the "<prefix>:path" notation.
This commit is contained in:
parent
f978e6b50e
commit
76a1489d4b
|
@ -12,6 +12,7 @@
|
||||||
*/
|
*/
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -28,6 +29,9 @@ import net.minecraft.client.multiplayer.NetClientHandler;
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
import net.minecraft.client.renderer.entity.Render;
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.resources.FileResourcePack;
|
||||||
|
import net.minecraft.client.resources.FolderResourcePack;
|
||||||
|
import net.minecraft.client.resources.ResourcePack;
|
||||||
import net.minecraft.crash.CrashReport;
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
@ -126,14 +130,18 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||||
|
|
||||||
private boolean serverShouldBeKilledQuietly;
|
private boolean serverShouldBeKilledQuietly;
|
||||||
|
|
||||||
|
private List<ResourcePack> resourcePackList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to start the whole game off
|
* Called to start the whole game off
|
||||||
*
|
*
|
||||||
* @param minecraft The minecraft instance being launched
|
* @param minecraft The minecraft instance being launched
|
||||||
|
* @param field_110449_ao
|
||||||
*/
|
*/
|
||||||
public void beginMinecraftLoading(Minecraft minecraft)
|
public void beginMinecraftLoading(Minecraft minecraft, List resourcePackList)
|
||||||
{
|
{
|
||||||
client = minecraft;
|
client = minecraft;
|
||||||
|
this.resourcePackList = resourcePackList;
|
||||||
if (minecraft.func_71355_q())
|
if (minecraft.func_71355_q())
|
||||||
{
|
{
|
||||||
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
|
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
|
||||||
|
@ -550,4 +558,19 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||||
{
|
{
|
||||||
return client.field_71462_r != null && client.field_71462_r.getClass().equals(gui);
|
return client.field_71462_r != null && client.field_71462_r.getClass().equals(gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addModAsResource(ModContainer container)
|
||||||
|
{
|
||||||
|
File modSource = container.getSource();
|
||||||
|
if (modSource.isFile())
|
||||||
|
{
|
||||||
|
resourcePackList.add(new FileResourcePack(modSource));
|
||||||
|
}
|
||||||
|
else if (modSource.isDirectory())
|
||||||
|
{
|
||||||
|
resourcePackList.add(new FolderResourcePack(modSource));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,4 +486,9 @@ public class FMLCommonHandler
|
||||||
}
|
}
|
||||||
return Joiner.on(',').join(modNames);
|
return Joiner.on(',').join(modNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addModToResourcePack(ModContainer container)
|
||||||
|
{
|
||||||
|
sidedDelegate.addModAsResource(container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* are made available under the terms of the GNU Lesser Public License v2.1
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* cpw - implementation
|
* cpw - implementation
|
||||||
*/
|
*/
|
||||||
|
@ -62,4 +62,6 @@ public interface IFMLSidedHandler
|
||||||
boolean shouldServerShouldBeKilledQuietly();
|
boolean shouldServerShouldBeKilledQuietly();
|
||||||
|
|
||||||
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
|
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
|
||||||
|
|
||||||
|
void addModAsResource(ModContainer container);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class LoadController
|
||||||
activeModList.add(mod);
|
activeModList.add(mod);
|
||||||
modStates.put(mod.getModId(), ModState.UNLOADED);
|
modStates.put(mod.getModId(), ModState.UNLOADED);
|
||||||
eventBus.put(mod.getModId(), bus);
|
eventBus.put(mod.getModId(), bus);
|
||||||
|
FMLCommonHandler.instance().addModToResourcePack(mod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.IFMLSidedHandler;
|
import cpw.mods.fml.common.IFMLSidedHandler;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.ModContainer;
|
||||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||||
|
@ -189,4 +190,9 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void addModAsResource(ModContainer container)
|
||||||
|
{
|
||||||
|
// NOOP on server
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue