Fix launching in dev
This commit is contained in:
parent
f95da817c4
commit
bec9214d0c
4 changed files with 47 additions and 22 deletions
20
build.gradle
20
build.gradle
|
@ -70,6 +70,18 @@ project(':forge') {
|
|||
patchedSrc = file('src/main/java')
|
||||
accessTransformer = file("$rootDir/src/main/resources/forge_at.cfg")
|
||||
srgPatches = false
|
||||
clientRun {
|
||||
main = 'net.minecraftforge.fml.LaunchTesting'
|
||||
env = [
|
||||
target: 'fmldevclient'
|
||||
]
|
||||
}
|
||||
serverRun {
|
||||
main = 'net.minecraftforge.fml.LaunchTesting'
|
||||
env = [
|
||||
target: 'fmldevserver'
|
||||
]
|
||||
}
|
||||
}
|
||||
applyPatches {
|
||||
canonicalizeAccess true
|
||||
|
@ -77,8 +89,8 @@ project(':forge') {
|
|||
maxFuzz 3
|
||||
}
|
||||
dependencies {
|
||||
implementation project(':clean')
|
||||
implementation 'cpw.mods:modlauncher:0.1+'
|
||||
implementation 'net.minecraft:client:1.13:extra'
|
||||
implementation 'cpw.mods:modlauncher:0.1.0-rc.3' //Pinned until cpw fixes getCommonSupertype
|
||||
implementation 'net.minecraftforge:accesstransformers:0.10+:shadowed'
|
||||
implementation 'net.minecraftforge:eventbus:0.1+:service'
|
||||
implementation 'net.minecraftforge:forgespi:0.1+'
|
||||
|
@ -120,7 +132,7 @@ project(':forge') {
|
|||
// jvmArgs = ['-verbose:class']
|
||||
classpath sourceSets.main.runtimeClasspath
|
||||
main 'net.minecraftforge.fml.LaunchTesting'
|
||||
systemProperties target:'fmldevclient'
|
||||
environment target:'fmldevclient'
|
||||
workingDir 'runclient'
|
||||
}
|
||||
|
||||
|
@ -131,7 +143,7 @@ project(':forge') {
|
|||
classpath sourceSets.main.runtimeClasspath
|
||||
main 'net.minecraftforge.fml.LaunchTesting'
|
||||
args 'nogui'
|
||||
systemProperties target:'fmldevserver'
|
||||
environment target:'fmldevserver'
|
||||
workingDir 'runserver'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
this.maxStackSize = p_i48487_1_.field_200920_a;
|
||||
+ this.canRepair = p_i48487_1_.canRepair;
|
||||
+ this.toolClasses.putAll(p_i48487_1_.toolClasses);
|
||||
+ Object tmp = net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.teisr);
|
||||
+ Object tmp = p_i48487_1_.teisr == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.teisr);
|
||||
+ this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer) tmp;
|
||||
if (this.maxDamage > 0) {
|
||||
this.addPropertyOverride(new ResourceLocation("damaged"), DAMAGED_GETTER);
|
||||
|
@ -154,10 +154,10 @@
|
|||
+ toolClasses.remove(toolClass);
|
||||
+ else
|
||||
+ toolClasses.put(toolClass, level);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ public void setTileEntityItemStackRenderer(java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer>> teisrSupplier) {
|
||||
+ this.teisr = teisrSupplier;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue