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')
|
patchedSrc = file('src/main/java')
|
||||||
accessTransformer = file("$rootDir/src/main/resources/forge_at.cfg")
|
accessTransformer = file("$rootDir/src/main/resources/forge_at.cfg")
|
||||||
srgPatches = false
|
srgPatches = false
|
||||||
|
clientRun {
|
||||||
|
main = 'net.minecraftforge.fml.LaunchTesting'
|
||||||
|
env = [
|
||||||
|
target: 'fmldevclient'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
serverRun {
|
||||||
|
main = 'net.minecraftforge.fml.LaunchTesting'
|
||||||
|
env = [
|
||||||
|
target: 'fmldevserver'
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
applyPatches {
|
applyPatches {
|
||||||
canonicalizeAccess true
|
canonicalizeAccess true
|
||||||
|
@ -77,8 +89,8 @@ project(':forge') {
|
||||||
maxFuzz 3
|
maxFuzz 3
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':clean')
|
implementation 'net.minecraft:client:1.13:extra'
|
||||||
implementation 'cpw.mods:modlauncher:0.1+'
|
implementation 'cpw.mods:modlauncher:0.1.0-rc.3' //Pinned until cpw fixes getCommonSupertype
|
||||||
implementation 'net.minecraftforge:accesstransformers:0.10+:shadowed'
|
implementation 'net.minecraftforge:accesstransformers:0.10+:shadowed'
|
||||||
implementation 'net.minecraftforge:eventbus:0.1+:service'
|
implementation 'net.minecraftforge:eventbus:0.1+:service'
|
||||||
implementation 'net.minecraftforge:forgespi:0.1+'
|
implementation 'net.minecraftforge:forgespi:0.1+'
|
||||||
|
@ -120,7 +132,7 @@ project(':forge') {
|
||||||
// jvmArgs = ['-verbose:class']
|
// jvmArgs = ['-verbose:class']
|
||||||
classpath sourceSets.main.runtimeClasspath
|
classpath sourceSets.main.runtimeClasspath
|
||||||
main 'net.minecraftforge.fml.LaunchTesting'
|
main 'net.minecraftforge.fml.LaunchTesting'
|
||||||
systemProperties target:'fmldevclient'
|
environment target:'fmldevclient'
|
||||||
workingDir 'runclient'
|
workingDir 'runclient'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +143,7 @@ project(':forge') {
|
||||||
classpath sourceSets.main.runtimeClasspath
|
classpath sourceSets.main.runtimeClasspath
|
||||||
main 'net.minecraftforge.fml.LaunchTesting'
|
main 'net.minecraftforge.fml.LaunchTesting'
|
||||||
args 'nogui'
|
args 'nogui'
|
||||||
systemProperties target:'fmldevserver'
|
environment target:'fmldevserver'
|
||||||
workingDir 'runserver'
|
workingDir 'runserver'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
this.maxStackSize = p_i48487_1_.field_200920_a;
|
this.maxStackSize = p_i48487_1_.field_200920_a;
|
||||||
+ this.canRepair = p_i48487_1_.canRepair;
|
+ this.canRepair = p_i48487_1_.canRepair;
|
||||||
+ this.toolClasses.putAll(p_i48487_1_.toolClasses);
|
+ 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;
|
+ this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer) tmp;
|
||||||
if (this.maxDamage > 0) {
|
if (this.maxDamage > 0) {
|
||||||
this.addPropertyOverride(new ResourceLocation("damaged"), DAMAGED_GETTER);
|
this.addPropertyOverride(new ResourceLocation("damaged"), DAMAGED_GETTER);
|
||||||
|
@ -154,10 +154,10 @@
|
||||||
+ toolClasses.remove(toolClass);
|
+ toolClasses.remove(toolClass);
|
||||||
+ else
|
+ else
|
||||||
+ toolClasses.put(toolClass, level);
|
+ toolClasses.put(toolClass, level);
|
||||||
}
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setTileEntityItemStackRenderer(java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer>> teisrSupplier) {
|
+ public void setTileEntityItemStackRenderer(java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer>> teisrSupplier) {
|
||||||
+ this.teisr = teisrSupplier;
|
+ this.teisr = teisrSupplier;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
}
|
||||||
|
|
|
@ -45,11 +45,24 @@ public class LaunchTesting
|
||||||
logcontext.getConfiguration().addFilter(axformFilter);
|
logcontext.getConfiguration().addFilter(axformFilter);
|
||||||
logcontext.getConfiguration().addFilter(eventbusFilter);
|
logcontext.getConfiguration().addFilter(eventbusFilter);
|
||||||
logcontext.updateLoggers();
|
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();
|
hackNatives();
|
||||||
Launcher.main("--launchTarget", System.getProperty("target"),"--gameDir", ".",
|
Launcher.main("--launchTarget", target,
|
||||||
"--accessToken", "blah", "--version", "FMLDev", "--assetIndex", "1.13",
|
"--gameDir", ".",
|
||||||
"--assetsDir","/home/cpw/MultiMC/assets",
|
"--accessToken", "blah",
|
||||||
|
"--version", "FMLDev",
|
||||||
|
"--assetIndex", "1.13",
|
||||||
|
"--assetsDir", assets,
|
||||||
"--userProperties", "{}");
|
"--userProperties", "{}");
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +70,7 @@ public class LaunchTesting
|
||||||
private static void hackNatives()
|
private static void hackNatives()
|
||||||
{
|
{
|
||||||
String paths = System.getProperty("java.library.path");
|
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))
|
if (Strings.isNullOrEmpty(paths))
|
||||||
paths = nativesDir;
|
paths = nativesDir;
|
||||||
|
|
|
@ -165,9 +165,9 @@ public class GameData
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@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")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -345,7 +345,7 @@ public class GameData
|
||||||
};
|
};
|
||||||
owner.setSlaveMap(BLOCKSTATE_TO_ID, idMap);
|
owner.setSlaveMap(BLOCKSTATE_TO_ID, idMap);
|
||||||
*/
|
*/
|
||||||
owner.setSlaveMap(BLOCK_TO_ITEM, HashBiMap.create());
|
owner.setSlaveMap(BLOCK_TO_ITEM, Maps.newHashMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -380,22 +380,22 @@ public class GameData
|
||||||
if (item instanceof ItemBlock)
|
if (item instanceof ItemBlock)
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
BiMap<Block, Item> blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, BiMap.class);
|
Map<Block, Item> blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, Map.class);
|
||||||
blockToItem.forcePut(((ItemBlock)item).getBlock(), item);
|
((ItemBlock)item).func_195946_a(blockToItem, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClear(IForgeRegistryInternal<Item> owner, RegistryManager stage)
|
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
|
@Override
|
||||||
public void onCreate(IForgeRegistryInternal<Item> owner, RegistryManager stage)
|
public void onCreate(IForgeRegistryInternal<Item> owner, RegistryManager stage)
|
||||||
{
|
{
|
||||||
// We share the blockItem map between items and blocks registries
|
// 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);
|
owner.setSlaveMap(BLOCK_TO_ITEM, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue