mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 10:34:49 +00:00
Fix launching in dev
This commit is contained in:
1 parent
f95da817c4
commit
bec9214d0c
4 files changed
+47
-22
No files matched your search
@@ -45,11 +45,24 @@ public class LaunchTesting
|
||||
logcontext.getConfiguration().addFilter(axformFilter);
|
||||
logcontext.getConfiguration().addFilter(eventbusFilter);
|
||||
logcontext.updateLoggers();
|
||||
System.setProperty("fml.explodedDir", "/home/cpw/projects/mods/inventorysorter/classes");
|
||||
File invsorter = new File("/home/cpw/projects/mods/inventorysorter/classes");
|
||||
if (invsorter.exists()) {
|
||||
System.setProperty("fml.explodedDir", "/home/cpw/projects/mods/inventorysorter/classes"); //TODO: Move this to a example included in our tests, not a random location...
|
||||
}
|
||||
String assets = System.getenv().getOrDefault("assetDirectory", "assets");
|
||||
String target = System.getenv().get("target");
|
||||
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("Environment variable target must be set.");
|
||||
}
|
||||
|
||||
hackNatives();
|
||||
Launcher.main("--launchTarget", System.getProperty("target"),"--gameDir", ".",
|
||||
"--accessToken", "blah", "--version", "FMLDev", "--assetIndex", "1.13",
|
||||
"--assetsDir","/home/cpw/MultiMC/assets",
|
||||
Launcher.main("--launchTarget", target,
|
||||
"--gameDir", ".",
|
||||
"--accessToken", "blah",
|
||||
"--version", "FMLDev",
|
||||
"--assetIndex", "1.13",
|
||||
"--assetsDir", assets,
|
||||
"--userProperties", "{}");
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
@@ -57,7 +70,7 @@ public class LaunchTesting
|
||||
private static void hackNatives()
|
||||
{
|
||||
String paths = System.getProperty("java.library.path");
|
||||
String nativesDir = "/home/cpw/.gradle/caches/minecraft/net/minecraft/natives/1.12.2";
|
||||
String nativesDir = "/home/cpw/.gradle/caches/minecraft/net/minecraft/natives/1.12.2"; //TODO Not hardcode this, FG setups us a natives folder. And sets it in the eclipse run configs.
|
||||
|
||||
if (Strings.isNullOrEmpty(paths))
|
||||
paths = nativesDir;
|
||||
|
||||
@@ -165,9 +165,9 @@ public class GameData
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static BiMap<Block,Item> getBlockItemMap()
|
||||
public static Map<Block,Item> getBlockItemMap()
|
||||
{
|
||||
return RegistryManager.ACTIVE.getRegistry(Item.class).getSlaveMap(BLOCK_TO_ITEM, BiMap.class);
|
||||
return RegistryManager.ACTIVE.getRegistry(Item.class).getSlaveMap(BLOCK_TO_ITEM, Map.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -345,7 +345,7 @@ public class GameData
|
||||
};
|
||||
owner.setSlaveMap(BLOCKSTATE_TO_ID, idMap);
|
||||
*/
|
||||
owner.setSlaveMap(BLOCK_TO_ITEM, HashBiMap.create());
|
||||
owner.setSlaveMap(BLOCK_TO_ITEM, Maps.newHashMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -380,22 +380,22 @@ public class GameData
|
||||
if (item instanceof ItemBlock)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
BiMap<Block, Item> blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, BiMap.class);
|
||||
blockToItem.forcePut(((ItemBlock)item).getBlock(), item);
|
||||
Map<Block, Item> blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, Map.class);
|
||||
((ItemBlock)item).func_195946_a(blockToItem, item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClear(IForgeRegistryInternal<Item> owner, RegistryManager stage)
|
||||
{
|
||||
owner.getSlaveMap(BLOCK_TO_ITEM, BiMap.class).clear();
|
||||
owner.getSlaveMap(BLOCK_TO_ITEM, Map.class).clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(IForgeRegistryInternal<Item> owner, RegistryManager stage)
|
||||
{
|
||||
// We share the blockItem map between items and blocks registries
|
||||
BiMap<?, ?> map = stage.getRegistry(BLOCKS).getSlaveMap(BLOCK_TO_ITEM, BiMap.class);
|
||||
Map<?, ?> map = stage.getRegistry(BLOCKS).getSlaveMap(BLOCK_TO_ITEM, Map.class);
|
||||
owner.setSlaveMap(BLOCK_TO_ITEM, map);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user