Compare commits

...
18 Commits
Author SHA1 Message Date
DreamMasterXXL 5044de32dd bump version 2021-10-18 22:33:21 +02:00
Martin Robertz 7b75ffb679 Merge pull request #6 from GTNewHorizons/patch-sorted-scripts
Sort received scripts in alphabetic order to prevent weird recipe loss
2021-10-18 20:38:20 +02:00
Glease 4787672b6e Sort received scripts according to their names 2021-10-19 02:36:12 +08:00
Martin Robertz 22502ff016 Merge pull request #5 from repo-alt/gtnh-legacy
restored ZenScript submodule pointer
2021-08-02 19:22:16 +02:00
repo_alt 7c060cb624 restored ZenScript submodule pointer 2021-08-02 20:20:21 +03:00
Martin Robertz b6a27cb150 Merge pull request #4 from repo-alt/gtnh-legacy
updated ZenScript submodule
2021-08-02 18:58:33 +02:00
repo_alt 6ffcca483f updated ZenScript submodule 2021-08-02 19:55:21 +03:00
DreamMasterXXL dc78b2b39e Merge remote-tracking branch 'origin/legacy' into gtnh-legacy
# Conflicts:
#	gradle/wrapper/gradle-wrapper.properties
2021-08-02 18:21:35 +02:00
Martin Robertz 436ad039ca Merge pull request #3 from Zaxar163/fix-legacy
Add more configuration options to MineTweaker network + update gradle.
2021-08-02 18:14:41 +02:00
Zaxar163 a348865dda Remove usage of sun.* in MineTweakerImplementationAPI 2021-06-29 10:25:16 +03:00
Zaxar163 86b4108e4f Configuration!
Config options:
handleDesktopPackets (Handle OpenBrowser and CopyClipboard packets? Insecure. Default false),
handleLoadScripts (Proccess LoadScripts packet on client? Insecure, takes time, but update scripts on the fly... Default true),
sendLoadScripts (Send scripts to players on logging in. Default true),
sendScriptsOnReloading (Send scripts to players on command "mt reload". Default true),
loadScriptsOnConnection (Load scripts before connect to server? Save time and traffic. Requires server with disabled sendLoadScripts. Default false),
antiStuck (Do not reload scripts when relogging, saves time. Usable when playing on one server/singleplayer... Default false).
Config lies at config/MineTweaker3.cfg
2021-06-29 10:24:43 +03:00
Zaxar163 4d4fed2482 Update gradle. 2021-06-29 10:24:32 +03:00
DreamMasterXXL 1796484e7c add(Craft-Tweaker)Changelog
update gradle
2021-06-28 10:12:45 +02:00
Jason Mitchell 8fff244d95 Make things undoable -- should (mostly) fix /mt reload 2020-11-29 16:37:29 -08:00
bartimaeusnek e4a0cc8f35 Fixed an oversight 2020-11-29 21:13:49 +01:00
bartimaeusnek 7c0eb67215 This is why i should init submodules. 2020-11-29 21:10:20 +01:00
bartimaeusnek 9167cd1f1d Added Overloads 2020-11-29 21:04:11 +01:00
Jason Mitchell af79e56481 Merge pull request #2 from GTNewHorizons/gtnh-legacy
Speedup - Inspired by the 1.12 version
2020-11-15 19:04:32 -08:00
28 changed files with 348 additions and 170 deletions

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
# CraftTweaker
Changelog of CraftTweaker.
+3 -4
View File
@@ -7,12 +7,11 @@ version = ext.mineTweakerVersion
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
task makeRegistry(type: RegisterZenClassesTask) { task makeRegistry(type: RegisterZenClassesTask) {
inputDir = file('build/classes/main') dependsOn tasks.compileJava
outputDir = file('build/classes/main') inputDir = file('build/classes/java/main')
outputDir = file('build/classes/java/main')
className = 'minetweaker.ClassRegistry' className = 'minetweaker.ClassRegistry'
} }
@@ -27,7 +27,6 @@ import minetweaker.api.world.IBiome;
import minetweaker.runtime.IScriptProvider; import minetweaker.runtime.IScriptProvider;
import minetweaker.util.EventList; import minetweaker.util.EventList;
import minetweaker.util.IEventHandler; import minetweaker.util.IEventHandler;
import sun.awt.HeadlessToolkit;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
@@ -58,6 +57,7 @@ public class MineTweakerImplementationAPI {
private static final ListenPlayerLoggedIn LISTEN_LOGIN = new ListenPlayerLoggedIn(); private static final ListenPlayerLoggedIn LISTEN_LOGIN = new ListenPlayerLoggedIn();
private static final ListenPlayerLoggedOut LISTEN_LOGOUT = new ListenPlayerLoggedOut(); private static final ListenPlayerLoggedOut LISTEN_LOGOUT = new ListenPlayerLoggedOut();
private static final ListenBlockInfo LISTEN_BLOCK_INFO = new ListenBlockInfo(); private static final ListenBlockInfo LISTEN_BLOCK_INFO = new ListenBlockInfo();
private static final EventList<ReloadEvent> ONROLLBACK = new EventList<>();
private static final EventList<ReloadEvent> ONRELOAD = new EventList<>(); private static final EventList<ReloadEvent> ONRELOAD = new EventList<>();
private static final EventList<ReloadEvent> ONPOSTRELOAD = new EventList<>(); private static final EventList<ReloadEvent> ONPOSTRELOAD = new EventList<>();
@@ -573,6 +573,9 @@ public class MineTweakerImplementationAPI {
* @param handler * @param handler
* @return * @return
*/ */
public static IEventHandle onRollbackEvent(IEventHandler<ReloadEvent> handler) {
return ONROLLBACK.add(handler);
}
public static IEventHandle onReloadEvent(IEventHandler<ReloadEvent> handler) { public static IEventHandle onReloadEvent(IEventHandler<ReloadEvent> handler) {
return ONRELOAD.add(handler); return ONRELOAD.add(handler);
} }
@@ -623,6 +626,8 @@ public class MineTweakerImplementationAPI {
} }
MineTweakerAPI.tweaker.rollback(); MineTweakerAPI.tweaker.rollback();
ONROLLBACK.publish(new ReloadEvent());
if (MineTweakerAPI.server != null) { if (MineTweakerAPI.server != null) {
if (!MineTweakerAPI.server.isCommandAdded("minetweaker")) { if (!MineTweakerAPI.server.isCommandAdded("minetweaker")) {
server.addCommand("minetweaker", "", new String[]{"mt", "crafttweaker", "ct"}, new ICommandFunction() { server.addCommand("minetweaker", "", new String[]{"mt", "crafttweaker", "ct"}, new ICommandFunction() {
@@ -686,7 +691,7 @@ public class MineTweakerImplementationAPI {
private static void copyToClipboard(String value) { private static void copyToClipboard(String value) {
StringSelection stringSelection = new StringSelection(value); StringSelection stringSelection = new StringSelection(value);
if (!(Toolkit.getDefaultToolkit() instanceof HeadlessToolkit)) { if (Desktop.isDesktopSupported()) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, null); clipboard.setContents(stringSelection, null);
} }
@@ -41,7 +41,9 @@ public interface IRecipeManager {
*/ */
@ZenMethod @ZenMethod
int remove(IIngredient output, @Optional boolean nbtMatch); int remove(IIngredient output, @Optional boolean nbtMatch);
int remove(IIngredient output);
/** /**
* Adds a shaped recipe. * Adds a shaped recipe.
* *
@@ -51,7 +53,12 @@ public interface IRecipeManager {
*/ */
@ZenMethod @ZenMethod
void addShaped(IItemStack output, IIngredient[][] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action); void addShaped(IItemStack output, IIngredient[][] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action);
void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function);
void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeAction action);
void addShaped(IItemStack output, IIngredient[][] ingredients);
/** /**
* Adds a mirrored shaped recipe. * Adds a mirrored shaped recipe.
* *
@@ -61,7 +68,12 @@ public interface IRecipeManager {
*/ */
@ZenMethod @ZenMethod
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action); void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action);
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function);
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeAction action);
void addShapedMirrored(IItemStack output, IIngredient[][] ingredients);
/** /**
* Adds a shapeless recipe. * Adds a shapeless recipe.
* *
@@ -71,7 +83,13 @@ public interface IRecipeManager {
*/ */
@ZenMethod @ZenMethod
void addShapeless(IItemStack output, IIngredient[] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action); void addShapeless(IItemStack output, IIngredient[] ingredients, @Optional IRecipeFunction function, @Optional IRecipeAction action);
void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function);
void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeAction action);
void addShapeless(IItemStack output, IIngredient[] ingredients);
/** /**
* Removes shaped recipes. * Removes shaped recipes.
* *
@@ -82,7 +100,8 @@ public interface IRecipeManager {
*/ */
@ZenMethod @ZenMethod
int removeShaped(IIngredient output, @Optional IIngredient[][] ingredients); int removeShaped(IIngredient output, @Optional IIngredient[][] ingredients);
int removeShaped(IIngredient output);
/** /**
* Removes shapeless recipes. * Removes shapeless recipes.
* *
@@ -95,7 +114,13 @@ public interface IRecipeManager {
*/ */
@ZenMethod @ZenMethod
int removeShapeless(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard); int removeShapeless(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard);
int removeShapeless(IIngredient output, boolean wildcard);
int removeShapeless(IIngredient output, IIngredient[] ingredients);
int removeShapeless(IIngredient output);
/** /**
* Performs a crafting with the specified ingredients. Returns null if no * Performs a crafting with the specified ingredients. Returns null if no
* crafting recipe exists. * crafting recipe exists.
@@ -52,6 +52,7 @@ public class MTTweaker implements ITweaker {
Object overrideKey = action.getOverrideKey(); Object overrideKey = action.getOverrideKey();
if (wereStuck.contains(action)) { if (wereStuck.contains(action)) {
MineTweakerAPI.logInfo("WAS STUCK");
wereStuck.remove(action); wereStuck.remove(action);
if (overrideKey != null) { if (overrideKey != null) {
@@ -76,7 +77,8 @@ public class MTTweaker implements ITweaker {
@Override @Override
public List<IUndoableAction> rollback() { public List<IUndoableAction> rollback() {
List<IUndoableAction> stuck = new ArrayList<IUndoableAction>(); // Note: Requires a OnRollback event to be fired. If this is called from MineTweakerImplementationAPI it's handled there.
List<IUndoableAction> stuck = new ArrayList<>();
for (int i = actions.size() - 1; i >= 0; i--) { for (int i = actions.size() - 1; i >= 0; i--) {
IUndoableAction action = actions.get(i); IUndoableAction action = actions.get(i);
if (action.canUndo()) { if (action.canUndo()) {
@@ -12,13 +12,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.DeflaterOutputStream; import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream; import java.util.zip.InflaterInputStream;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
@@ -74,7 +68,7 @@ public class ScriptProviderMemory implements IScriptProvider {
private final Map<String, MemoryModule> modules; private final Map<String, MemoryModule> modules;
public ScriptProviderMemory(byte[] scripts) { public ScriptProviderMemory(byte[] scripts) {
modules = new HashMap<String, MemoryModule>(); modules = new TreeMap<String, MemoryModule>();
try { try {
InflaterInputStream inflater = new InflaterInputStream(new ByteArrayInputStream(scripts)); InflaterInputStream inflater = new InflaterInputStream(new ByteArrayInputStream(scripts));
+3 -21
View File
@@ -1,29 +1,10 @@
import minetweaker.tasks.RegisterZenClassesTask; import minetweaker.tasks.RegisterZenClassesTask;
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'maven' apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = "1.7.10-" + ext.mineTweakerVersion version = "1.7.10-" + ext.mineTweakerVersion
archivesBaseName = project.projectDir.name archivesBaseName = project.projectDir.name
@@ -40,8 +21,9 @@ dependencies {
} }
task makeRegistry(type: RegisterZenClassesTask) { task makeRegistry(type: RegisterZenClassesTask) {
inputDir = file('build/classes/main') dependsOn tasks.compileJava
outputDir = file('build/classes/main') inputDir = file('build/classes/java/main')
outputDir = file('build/classes/java/main')
className = 'minetweaker.mc1710.MineTweakerRegistry' className = 'minetweaker.mc1710.MineTweakerRegistry'
} }
@@ -22,7 +22,7 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
public class FMLEventHandler { public class FMLEventHandler {
@SubscribeEvent @SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent ev) { public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent ev) {
if (ev.player instanceof EntityPlayerMP) { if (ev.player instanceof EntityPlayerMP && MineTweakerConfig.sendLoadScripts) {
EntityPlayerMP player = (EntityPlayerMP) ev.player; EntityPlayerMP player = (EntityPlayerMP) ev.player;
MineTweakerMod.NETWORK.sendTo(new MineTweakerLoadScriptsPacket(MineTweakerAPI.tweaker.getScriptData()), player); MineTweakerMod.NETWORK.sendTo(new MineTweakerLoadScriptsPacket(MineTweakerAPI.tweaker.getScriptData()), player);
} }
@@ -7,6 +7,8 @@
package minetweaker.mc1710; package minetweaker.mc1710;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import minetweaker.*; import minetweaker.*;
import minetweaker.api.entity.*; import minetweaker.api.entity.*;
import minetweaker.api.formatting.IFormattedText; import minetweaker.api.formatting.IFormattedText;
@@ -15,10 +17,12 @@ import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.tooltip.IngredientTooltips; import minetweaker.api.tooltip.IngredientTooltips;
import minetweaker.mc1710.formatting.IMCFormattedString; import minetweaker.mc1710.formatting.IMCFormattedString;
import minetweaker.mc1710.item.*; import minetweaker.mc1710.item.*;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.entity.*; import net.minecraft.entity.*;
import net.minecraft.entity.item.*; import net.minecraft.entity.item.*;
import net.minecraft.entity.player.*; import net.minecraft.entity.player.*;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.event.entity.living.*; import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -42,6 +46,12 @@ public class ForgeEventHandler {
MineTweakerImplementationAPI.events.publishPlayerInteract(event); MineTweakerImplementationAPI.events.publishPlayerInteract(event);
} }
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlayerGuiOpen(GuiOpenEvent ev) {
if (ev.gui != null && ev.gui instanceof GuiConnecting) MineTweakerMod.INSTANCE.onClientAboutToConnect();
}
@SubscribeEvent @SubscribeEvent
public void onItemTooltip(ItemTooltipEvent ev) { public void onItemTooltip(ItemTooltipEvent ev) {
if(ev.itemStack!= null) { if(ev.itemStack!= null) {
@@ -32,7 +32,7 @@ public class MCPlatformFunctions implements IPlatformFunctions {
@Override @Override
public void distributeScripts(byte[] data) { public void distributeScripts(byte[] data) {
MineTweakerMod.NETWORK.sendToAll(new MineTweakerLoadScriptsPacket(data)); if (MineTweakerConfig.sendScriptsOnReloading) MineTweakerMod.NETWORK.sendToAll(new MineTweakerLoadScriptsPacket(data));
} }
@Override @Override
@@ -0,0 +1,32 @@
package minetweaker.mc1710;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
public class MineTweakerConfig {
private MineTweakerConfig() { }
public static boolean handleDesktopPackets = false, handleLoadScripts = true, sendLoadScripts = true,
sendScriptsOnReloading = true, loadScriptsBeforeConnection = false, antiStuck = true;
static File file;
public static void load() {
Configuration config = new Configuration(file, "1");
config.load();
handleDesktopPackets = config.getBoolean("handleDesktopPackets",
"network", false, "Handle OpenBrowser and CopyClipboard packets? Insecure.");
handleLoadScripts = config.getBoolean("handleLoadScripts", "network", true,
"Proccess LoadScripts packet on client? Insecure, takes time, but update scripts on the fly...");
sendLoadScripts = config.getBoolean("sendLoadScripts",
"network", true, "Send scripts to players on logging in");
sendScriptsOnReloading = config.getBoolean("sendScriptsOnReloading",
"network", true, "Send scripts to players on command \"mt reload\"");
loadScriptsBeforeConnection = config.getBoolean("loadScriptsBeforeConnection",
"core", false, "Load scripts before connect to server? Save time and traffic. Requires server with disabled sendLoadScripts.");
antiStuck = config.getBoolean("antiStuck",
"core", false, "Do not reload scripts when relogging, saves time. Usable when playing on one server/singleplayer...");
config.save();
}
}
@@ -35,6 +35,7 @@ import minetweaker.runtime.*;
import minetweaker.runtime.providers.ScriptProviderCascade; import minetweaker.runtime.providers.ScriptProviderCascade;
import minetweaker.runtime.providers.ScriptProviderCustom; import minetweaker.runtime.providers.ScriptProviderCustom;
import minetweaker.runtime.providers.ScriptProviderDirectory; import minetweaker.runtime.providers.ScriptProviderDirectory;
import net.minecraft.client.Minecraft;
import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@@ -82,6 +83,7 @@ public class MineTweakerMod {
private final IScriptProvider scriptsGlobal; private final IScriptProvider scriptsGlobal;
private final ScriptProviderCustom scriptsIMC; private final ScriptProviderCustom scriptsIMC;
private volatile boolean loaded = false;
public MineTweakerMod() { public MineTweakerMod() {
MCRecipeManager.recipes = (List<IRecipe>) CraftingManager.getInstance().getRecipeList(); MCRecipeManager.recipes = (List<IRecipe>) CraftingManager.getInstance().getRecipeList();
@@ -127,6 +129,8 @@ public class MineTweakerMod {
@EventHandler @EventHandler
public void onLoad(FMLPreInitializationEvent ev) { public void onLoad(FMLPreInitializationEvent ev) {
MineTweakerConfig.file = new File(ev.getModConfigurationDirectory(), MODID + ".cfg");
MineTweakerConfig.load();
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler()); MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
FMLCommonHandler.instance().bus().register(new FMLEventHandler()); FMLCommonHandler.instance().bus().register(new FMLEventHandler());
} }
@@ -148,17 +152,13 @@ public class MineTweakerMod {
ItemBracketHandler.rebuildItemRegistry(); ItemBracketHandler.rebuildItemRegistry();
LiquidBracketHandler.rebuildLiquidRegistry(); LiquidBracketHandler.rebuildLiquidRegistry();
MineTweakerAPI.logInfo("MineTweaker: Sucessfully built item registry"); MineTweakerAPI.logInfo("MineTweaker: Sucessfully built item registry");
if (MineTweakerPlatformUtils.isClient()) {
MineTweakerAPI.client = new MCClient();
}
} }
@EventHandler @EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { public void onServerAboutToStart(FMLServerAboutToStartEvent ev) {
// starts before loading worlds
// perfect place to start MineTweaker!
if (MineTweakerPlatformUtils.isClient()) {
MineTweakerAPI.client = new MCClient();
}
File scriptsDir = new File(MineTweakerHacks.getWorldDirectory(ev.getServer()), "scripts"); File scriptsDir = new File(MineTweakerHacks.getWorldDirectory(ev.getServer()), "scripts");
if (!scriptsDir.exists()) { if (!scriptsDir.exists()) {
scriptsDir.mkdir(); scriptsDir.mkdir();
@@ -168,12 +168,21 @@ public class MineTweakerMod {
IScriptProvider cascaded = new ScriptProviderCascade(scriptsIMC, scriptsGlobal,scriptsLocal); IScriptProvider cascaded = new ScriptProviderCascade(scriptsIMC, scriptsGlobal,scriptsLocal);
MineTweakerImplementationAPI.setScriptProvider(cascaded); MineTweakerImplementationAPI.setScriptProvider(cascaded);
MineTweakerImplementationAPI.onServerStart(new MCServer(ev.getServer())); MCServer srv = new MCServer(ev.getServer());
if (loaded && MineTweakerConfig.antiStuck) MineTweakerAPI.server = srv;
else {
MineTweakerImplementationAPI.onServerStart(srv);
loaded = true;
}
} }
@EventHandler public void onClientAboutToConnect() {
public void onServerStarting(FMLServerStartingEvent ev) { if (!MineTweakerConfig.loadScriptsBeforeConnection) return;
IScriptProvider cascaded = new ScriptProviderCascade(scriptsIMC, scriptsGlobal);
MineTweakerImplementationAPI.setScriptProvider(cascaded);
if (loaded && MineTweakerConfig.antiStuck) return;
MineTweakerImplementationAPI.reload();
loaded = true;
} }
@EventHandler @EventHandler
@@ -9,6 +9,8 @@ package minetweaker.mc1710.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.mc1710.MineTweakerConfig;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
@@ -21,7 +23,7 @@ import java.awt.datatransfer.StringSelection;
public class MineTweakerCopyClipboardHandler implements IMessageHandler<MineTweakerCopyClipboardPacket, IMessage> { public class MineTweakerCopyClipboardHandler implements IMessageHandler<MineTweakerCopyClipboardPacket, IMessage> {
@Override @Override
public IMessage onMessage(MineTweakerCopyClipboardPacket message, MessageContext ctx) { public IMessage onMessage(MineTweakerCopyClipboardPacket message, MessageContext ctx) {
if (Desktop.isDesktopSupported()) { if (Desktop.isDesktopSupported() && MineTweakerConfig.handleDesktopPackets) {
StringSelection stringSelection = new StringSelection(message.getData()); StringSelection stringSelection = new StringSelection(message.getData());
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, null); clipboard.setContents(stringSelection, null);
@@ -11,7 +11,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI;
import minetweaker.mc1710.client.MCClient; import minetweaker.mc1710.MineTweakerConfig;
import minetweaker.runtime.providers.ScriptProviderMemory; import minetweaker.runtime.providers.ScriptProviderMemory;
/** /**
@@ -21,13 +21,10 @@ import minetweaker.runtime.providers.ScriptProviderMemory;
public class MineTweakerLoadScriptsHandler implements IMessageHandler<MineTweakerLoadScriptsPacket, IMessage> { public class MineTweakerLoadScriptsHandler implements IMessageHandler<MineTweakerLoadScriptsPacket, IMessage> {
@Override @Override
public IMessage onMessage(MineTweakerLoadScriptsPacket message, MessageContext ctx) { public IMessage onMessage(MineTweakerLoadScriptsPacket message, MessageContext ctx) {
if (MineTweakerAPI.server == null) { if (MineTweakerAPI.server == null && MineTweakerConfig.handleLoadScripts) {
MineTweakerAPI.client = new MCClient();
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderMemory(message.getData())); MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderMemory(message.getData()));
MineTweakerImplementationAPI.reload(); MineTweakerImplementationAPI.reload();
} }
return null; return null;
} }
} }
@@ -9,6 +9,8 @@ package minetweaker.mc1710.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.mc1710.MineTweakerConfig;
import java.awt.Desktop; import java.awt.Desktop;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@@ -21,15 +23,13 @@ import java.net.URISyntaxException;
public class MineTweakerOpenBrowserHandler implements IMessageHandler<MineTweakerOpenBrowserPacket, IMessage> { public class MineTweakerOpenBrowserHandler implements IMessageHandler<MineTweakerOpenBrowserPacket, IMessage> {
@Override @Override
public IMessage onMessage(MineTweakerOpenBrowserPacket message, MessageContext ctx) { public IMessage onMessage(MineTweakerOpenBrowserPacket message, MessageContext ctx) {
if (Desktop.isDesktopSupported()) { if (Desktop.isDesktopSupported() && MineTweakerConfig.handleDesktopPackets) {
Desktop desktop = Desktop.getDesktop(); Desktop desktop = Desktop.getDesktop();
try { try {
desktop.browse(new URI(message.getUrl())); desktop.browse(new URI(message.getUrl()));
} catch (IOException e) { } catch (IOException e) {
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
} }
} else {
System.out.println("Desktop not supported");
} }
return null; return null;
@@ -12,6 +12,7 @@ import minetweaker.api.data.IData;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.player.IPlayer; import minetweaker.api.player.IPlayer;
import minetweaker.mc1710.MineTweakerConfig;
import minetweaker.mc1710.MineTweakerMod; import minetweaker.mc1710.MineTweakerMod;
import minetweaker.mc1710.data.NBTConverter; import minetweaker.mc1710.data.NBTConverter;
import minetweaker.mc1710.network.MineTweakerCopyClipboardPacket; import minetweaker.mc1710.network.MineTweakerCopyClipboardPacket;
@@ -126,7 +127,7 @@ public class MCPlayer implements IPlayer {
@Override @Override
public void openBrowser(String url) { public void openBrowser(String url) {
if (player instanceof EntityPlayerMP) { if (player instanceof EntityPlayerMP && MineTweakerConfig.handleDesktopPackets) {
MineTweakerMod.NETWORK.sendTo( MineTweakerMod.NETWORK.sendTo(
new MineTweakerOpenBrowserPacket(url), new MineTweakerOpenBrowserPacket(url),
(EntityPlayerMP) player); (EntityPlayerMP) player);
@@ -135,7 +136,7 @@ public class MCPlayer implements IPlayer {
@Override @Override
public void copyToClipboard(String value) { public void copyToClipboard(String value) {
if (player instanceof EntityPlayerMP) { if (player instanceof EntityPlayerMP && MineTweakerConfig.handleDesktopPackets) {
MineTweakerMod.NETWORK.sendTo( MineTweakerMod.NETWORK.sendTo(
new MineTweakerCopyClipboardPacket(value), new MineTweakerCopyClipboardPacket(value),
(EntityPlayerMP) player); (EntityPlayerMP) player);
@@ -48,12 +48,14 @@ public final class MCRecipeManager implements IRecipeManager {
public static final List<ActionBaseAddRecipe> recipesToAdd = new ArrayList<>(); public static final List<ActionBaseAddRecipe> recipesToAdd = new ArrayList<>();
public static final List<ActionBaseRemoveRecipes> recipesToRemove = new ArrayList<>(); public static final List<ActionBaseRemoveRecipes> recipesToRemove = new ArrayList<>();
public static final ActionRemoveRecipesNoIngredients actionRemoveRecipesNoIngredients = new ActionRemoveRecipesNoIngredients(); public static final ActionRemoveRecipesNoIngredients actionRemoveRecipesNoIngredients = new ActionRemoveRecipesNoIngredients();
public static final List<IRecipe> recipesToUndo = new ArrayList<>();
public static List<IRecipe> recipes; public static List<IRecipe> recipes;
public static final List<ICraftingRecipe> transformerRecipes = new ArrayList<>(); public static final List<ICraftingRecipe> transformerRecipes = new ArrayList<>();
public MCRecipeManager() { public MCRecipeManager() {
MineTweakerImplementationAPI.onPostReload(new HandlePostReload()); MineTweakerImplementationAPI.onPostReload(new HandleLateAdditionsAndRemovals());
MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals());
} }
public static boolean hasTransformerRecipes() { public static boolean hasTransformerRecipes() {
@@ -109,6 +111,11 @@ public final class MCRecipeManager implements IRecipeManager {
return results; return results;
} }
@Override
public int remove(IIngredient output) {
return remove(output, false);
}
@Override @Override
public int remove(IIngredient output, @Optional boolean nbtMatch) { public int remove(IIngredient output, @Optional boolean nbtMatch) {
if(output == null) { if(output == null) {
@@ -119,11 +126,41 @@ public final class MCRecipeManager implements IRecipeManager {
return 1; return 1;
} }
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, null, false));
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, action, false));
}
@Override
public void addShaped(IItemStack output, IIngredient[][] ingredients) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, null, false));
}
@Override @Override
public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action) { public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, action, false)); recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, action, false));
} }
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, null, true));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, null, true));
}
@Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, null, action, true));
}
@Override @Override
public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action) { public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action) {
recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, action, true)); recipesToAdd.add(new ActionAddShapedRecipe(output, ingredients, function, action, true));
@@ -137,6 +174,21 @@ public final class MCRecipeManager implements IRecipeManager {
recipesToAdd.add(new ActionAddShapelessRecipe(output, ingredients, function, action)); recipesToAdd.add(new ActionAddShapelessRecipe(output, ingredients, function, action));
} }
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function){
addShapeless(output, ingredients, function, null);
}
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeAction action){
addShapeless(output, ingredients, null, action);
}
@Override
public void addShapeless(IItemStack output, IIngredient[] ingredients){
addShapeless(output, ingredients, null, null);
}
private boolean checkShapelessNulls(IItemStack output, IIngredient[] ingredients) { private boolean checkShapelessNulls(IItemStack output, IIngredient[] ingredients) {
if(output != null && Arrays.stream(ingredients).allMatch(Objects::isNull)) { if(output != null && Arrays.stream(ingredients).allMatch(Objects::isNull)) {
MineTweakerAPI.logError("Null not allowed in shapeless recipes! Recipe for: " + output + " not created!"); MineTweakerAPI.logError("Null not allowed in shapeless recipes! Recipe for: " + output + " not created!");
@@ -155,6 +207,11 @@ public final class MCRecipeManager implements IRecipeManager {
return 1; return 1;
} }
@Override
public int removeShaped(IIngredient output) {
return removeShaped(output, null);
}
@Override @Override
public int removeShapeless(IIngredient output, IIngredient[] ingredients, boolean wildcard) { public int removeShapeless(IIngredient output, IIngredient[] ingredients, boolean wildcard) {
if(output == null) { if(output == null) {
@@ -165,6 +222,21 @@ public final class MCRecipeManager implements IRecipeManager {
return 1; return 1;
} }
@Override
public int removeShapeless(IIngredient output, IIngredient[] ingredients) {
return removeShapeless(output, ingredients, false);
}
@Override
public int removeShapeless(IIngredient output, boolean wildcard) {
return removeShapeless(output, null, wildcard);
}
@Override
public int removeShapeless(IIngredient output) {
return removeShapeless(output, null, true);
}
@Override @Override
public IItemStack craft(IItemStack[][] contents) { public IItemStack craft(IItemStack[][] contents) {
Container container = new ContainerVirtual(); Container container = new ContainerVirtual();
@@ -205,14 +277,19 @@ public final class MCRecipeManager implements IRecipeManager {
public static class ActionRemoveRecipesNoIngredients extends ActionBaseRemoveRecipes implements IUndoableAction { public static class ActionRemoveRecipesNoIngredients extends ActionBaseRemoveRecipes implements IUndoableAction {
// pair of output, nbtMatch // pair of output, nbtMatch
private final List<Pair<IIngredient, Boolean>> outputs = new ArrayList<>(); private final List<Pair<IIngredient, Boolean>> outputs = new ArrayList<>();
private final Set<IRecipe> toRemove = new HashSet<>();
public void addOutput(IIngredient output, @Optional boolean nbtMatch) { public void addOutput(IIngredient output, @Optional boolean nbtMatch) {
outputs.add(Pair.of(output, nbtMatch)); outputs.add(Pair.of(output, nbtMatch));
} }
public void clearOutputs() {
outputs.clear();
}
@Override @Override
public void apply() { public void apply() {
Set<IRecipe> toRemove = new HashSet<>(); toRemove.clear();
for (final IRecipe recipe : recipes) { for (final IRecipe recipe : recipes) {
final ItemStack recipeOutput = recipe.getRecipeOutput(); final ItemStack recipeOutput = recipe.getRecipeOutput();
@@ -228,12 +305,14 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public boolean canUndo() { public boolean canUndo() {
return false; return !toRemove.isEmpty();
} }
@Override @Override
public void undo() { public void undo() {
for(IRecipe recipe: toRemove) {
recipesToAdd.add(new ActionBaseAddRecipe(recipe));
}
} }
@Override @Override
@@ -243,7 +322,7 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public String describeUndo() { public String describeUndo() {
return null; return "Trying to restore " + toRemove.size() + " recipes.";
} }
@Override @Override
@@ -268,7 +347,8 @@ public final class MCRecipeManager implements IRecipeManager {
final IIngredient output; final IIngredient output;
final IIngredient[] ingredients; final IIngredient[] ingredients;
final boolean wildcard; final boolean wildcard;
Set<IRecipe> toRemove = new HashSet<>();
public ActionRemoveShapelessRecipes(IIngredient output, IIngredient[] ingredients, boolean wildcard) { public ActionRemoveShapelessRecipes(IIngredient output, IIngredient[] ingredients, boolean wildcard) {
this.output = output; this.output = output;
this.ingredients = ingredients; this.ingredients = ingredients;
@@ -277,7 +357,7 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public void apply() { public void apply() {
Set<IRecipe> toRemove = new HashSet<>(); toRemove.clear();
outer: outer:
for (IRecipe recipe : recipes) { for (IRecipe recipe : recipes) {
@@ -342,12 +422,14 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public boolean canUndo() { public boolean canUndo() {
return false; return !toRemove.isEmpty();
} }
@Override @Override
public void undo() { public void undo() {
for(IRecipe recipe: toRemove) {
recipesToAdd.add(new ActionBaseAddRecipe(recipe));
}
} }
@Override @Override
@@ -361,7 +443,7 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public String describeUndo() { public String describeUndo() {
return null; return "Trying to restore " + toRemove.size() + " shapeless recipes.";
} }
@Override @Override
@@ -373,6 +455,8 @@ public final class MCRecipeManager implements IRecipeManager {
public static class ActionRemoveShapedRecipes extends ActionBaseRemoveRecipes implements IUndoableAction { public static class ActionRemoveShapedRecipes extends ActionBaseRemoveRecipes implements IUndoableAction {
final IIngredient output; final IIngredient output;
final IIngredient[][] ingredients; final IIngredient[][] ingredients;
final Set<IRecipe> toRemove = new HashSet<>();
public ActionRemoveShapedRecipes(IIngredient output, IIngredient[][] ingredients) { public ActionRemoveShapedRecipes(IIngredient output, IIngredient[][] ingredients) {
@@ -384,6 +468,7 @@ public final class MCRecipeManager implements IRecipeManager {
public void apply() { public void apply() {
int ingredientsWidth = 0; int ingredientsWidth = 0;
int ingredientsHeight = 0; int ingredientsHeight = 0;
toRemove.clear();
if (ingredients != null) { if (ingredients != null) {
ingredientsHeight = ingredients.length; ingredientsHeight = ingredients.length;
@@ -393,8 +478,6 @@ public final class MCRecipeManager implements IRecipeManager {
} }
} }
final Set<IRecipe> toRemove = new HashSet<>();
outer: outer:
for (final IRecipe recipe : recipes) { for (final IRecipe recipe : recipes) {
final ItemStack output = recipe.getRecipeOutput(); final ItemStack output = recipe.getRecipeOutput();
@@ -438,22 +521,28 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public boolean canUndo() { public boolean canUndo() {
return false; return !toRemove.isEmpty();
} }
@Override @Override
public void undo() { public void undo() {
for(IRecipe recipe: toRemove) {
recipesToAdd.add(new ActionBaseAddRecipe(recipe));
}
} }
@Override @Override
public String describe() { public String describe() {
return null; if(output != null) {
return "Removing Shaped recipes for " + output.toString();
} else {
return "Trying to remove recipes for invalid output";
}
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return null; return "Trying to restore " + toRemove.size() + " shaped recipes.";
} }
@Override @Override
@@ -468,39 +557,49 @@ public final class MCRecipeManager implements IRecipeManager {
protected final IItemStack output; protected final IItemStack output;
protected final boolean isShaped; protected final boolean isShaped;
protected final boolean isRestoring;
private ActionBaseAddRecipe(IRecipe iRecipe) {
this.iRecipe = iRecipe;
this.craftingRecipe = null;
this.isRestoring = true;
this.isShaped = iRecipe instanceof ShapedRecipes;
this.output = new MCItemStack(iRecipe.getRecipeOutput());
}
private ActionBaseAddRecipe(ICraftingRecipe craftingRecipe, IItemStack output, boolean isShaped) { private ActionBaseAddRecipe(ICraftingRecipe craftingRecipe, IItemStack output, boolean isShaped) {
this.iRecipe = RecipeConverter.convert(craftingRecipe); this.iRecipe = RecipeConverter.convert(craftingRecipe);
this.craftingRecipe = craftingRecipe; this.craftingRecipe = craftingRecipe;
this.isRestoring = false;
this.output = output; this.output = output;
this.isShaped = isShaped; this.isShaped = isShaped;
// if(craftingRecipe.hasTransformers())
// transformerRecipes.add(craftingRecipe);
} }
@Override @Override
public void apply() { public void apply() {
recipes.add(iRecipe); recipes.add(iRecipe);
if (craftingRecipe.hasTransformers()) if (craftingRecipe != null && craftingRecipe.hasTransformers())
transformerRecipes.add(craftingRecipe); transformerRecipes.add(craftingRecipe);
} }
@Override @Override
public boolean canUndo() { public boolean canUndo() {
return false; return iRecipe != null;
} }
@Override @Override
public void undo() { public void undo() {
recipesToUndo.add(iRecipe);
} }
@Override @Override
public String describe() { public String describe() {
if(output != null) { if(output != null) {
return "Adding " + (isShaped ? "shaped" : "shapeless") + " recipe for " + output.getDisplayName(); return "" + (this.isRestoring ? "Restoring" : "Adding ") + (isShaped ? "shaped" : "shapeless") + " recipe for " + output.getDisplayName();
} else { } else {
return "Trying to add " + (isShaped ? "shaped" : "shapeless") + "recipe without correct output"; return "Trying to add " + (isShaped ? "shaped" : "shapeless") + "recipe without correct output";
} }
@@ -508,7 +607,7 @@ public final class MCRecipeManager implements IRecipeManager {
@Override @Override
public String describeUndo() { public String describeUndo() {
return null; return "Undoing addition of " + output.getDisplayName();
} }
@Override @Override
@@ -528,17 +627,28 @@ public final class MCRecipeManager implements IRecipeManager {
super(new ShapelessRecipe(output, ingredients, function, action), output, false); super(new ShapelessRecipe(output, ingredients, function, action), output, false);
} }
} }
public static void applyAdditionsAndRemovals() {
System.out.println("MineTweaker: Applying additions and removals");
MineTweakerAPI.apply(MCRecipeManager.actionRemoveRecipesNoIngredients);
if(recipesToUndo.size() > 0) {
recipes.removeIf(recipesToUndo::contains);
}
MCRecipeManager.recipesToRemove.forEach(MineTweakerAPI::apply);
MCRecipeManager.recipesToAdd.forEach(MineTweakerAPI::apply);
actionRemoveRecipesNoIngredients.clearOutputs();
recipesToRemove.clear();;
recipesToAdd.clear();
recipesToUndo.clear();
}
public static class HandlePostReload implements IEventHandler<MineTweakerImplementationAPI.ReloadEvent> public static class HandleLateAdditionsAndRemovals implements IEventHandler<MineTweakerImplementationAPI.ReloadEvent>
{ {
@Override @Override
public void handle(MineTweakerImplementationAPI.ReloadEvent event) public void handle(MineTweakerImplementationAPI.ReloadEvent event)
{ {
System.out.println("MineTweaker: Applying additions and removals"); MCRecipeManager.applyAdditionsAndRemovals();
MineTweakerAPI.apply(MCRecipeManager.actionRemoveRecipesNoIngredients);
MCRecipeManager.recipesToRemove.forEach(MineTweakerAPI::apply);
MCRecipeManager.recipesToAdd.forEach(MineTweakerAPI::apply);
} }
} }
+3 -21
View File
@@ -1,28 +1,9 @@
import minetweaker.tasks.RegisterZenClassesTask; import minetweaker.tasks.RegisterZenClassesTask;
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'forge' apply plugin: 'forge'
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft { minecraft {
version = forgeVersion1710 version = forgeVersion1710
@@ -39,8 +20,9 @@ dependencies {
} }
task makeRegistry(type: RegisterZenClassesTask) { task makeRegistry(type: RegisterZenClassesTask) {
inputDir = file('build/classes/main') dependsOn tasks.compileJava
outputDir = file('build/classes/main') inputDir = file('build/classes/java/main')
outputDir = file('build/classes/java/main')
className = 'minetweaker.mods.ic2.ClassRegistry' className = 'minetweaker.mods.ic2.ClassRegistry'
} }
+3 -21
View File
@@ -1,28 +1,9 @@
import minetweaker.tasks.RegisterZenClassesTask; import minetweaker.tasks.RegisterZenClassesTask;
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'forge' apply plugin: 'forge'
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft { minecraft {
version = forgeVersion1710 version = forgeVersion1710
@@ -40,8 +21,9 @@ dependencies {
} }
task makeRegistry(type: RegisterZenClassesTask) { task makeRegistry(type: RegisterZenClassesTask) {
inputDir = file('build/classes/main') dependsOn tasks.compileJava
outputDir = file('build/classes/main') inputDir = file('build/classes/java/main')
outputDir = file('build/classes/java/main')
className = 'minetweaker.mods.nei.ClassRegistry' className = 'minetweaker.mods.nei.ClassRegistry'
} }
+29 -9
View File
@@ -1,16 +1,41 @@
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
}
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
classpath "com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT"
}
}
apply plugin: 'base' // To add "clean" task to the root project. apply plugin: 'base' // To add "clean" task to the root project.
apply from: 'configuration.gradle' apply from: 'configuration.gradle'
apply plugin: "maven" apply plugin: "maven"
subprojects { subprojects {
apply from: rootProject.file('common.gradle') apply from: rootProject.file('common.gradle')
apply plugin: 'eclipse'
} }
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
maven { /*maven {
name "Tesla" name "Tesla"
url 'http://maven.epoxide.xyz' url 'http://maven.epoxide.xyz'
} }
@@ -21,7 +46,7 @@ repositories {
maven { maven {
name 'JEI' name 'JEI'
url "http://dvs1.progwml6.com/files/maven" url "http://dvs1.progwml6.com/files/maven"
} } unused */
} }
configurations { configurations {
deployerJars deployerJars
@@ -30,11 +55,6 @@ dependencies {
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.2' deployerJars 'org.apache.maven.wagon:wagon-ftp:2.2'
} }
task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') {
gradleVersion = '3.0'
}
subprojects.each { subproject -> evaluationDependsOn( subproject.path ) } subprojects.each { subproject -> evaluationDependsOn( subproject.path ) }
task setupDecompWorkspaceAll(dependsOn: projects1710.collect { ':' + it + ":setupDecompWorkspace" }) {} task setupDecompWorkspaceAll(dependsOn: projects1710.collect { ':' + it + ":setupDecompWorkspace" }) {}
@@ -37,7 +37,15 @@ public class RegisterZenClassesTask extends DefaultTask {
@OutputDirectory @OutputDirectory
public File outputDir = null; public File outputDir = null;
public void setInputDir(File inputDir) {
this.inputDir = inputDir;
}
public void setOutputDir(File inputDir) {
this.outputDir = inputDir;
}
@Input @Input
public String className; public String className;
+15 -2
View File
@@ -7,13 +7,26 @@ apply from: rootProject.file('configuration.gradle')
// -- end of configurable properties // -- end of configurable properties
repositories { repositories {
mavenLocal()
mavenCentral() mavenCentral()
maven { maven {
name = "forge" name = "forge"
url = "http://files.minecraftforge.net/maven" url = "http://files.minecraftforge.net/maven"
} }
maven { maven {
name = "sonatype" name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/" url = "https://oss.sonatype.org/content/repositories/snapshots/"
} }
} maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ import javax.tools.ToolProvider
// ### Global settings ### // ### Global settings ###
// ####################### // #######################
ext.mineTweakerVersion = "3.2.1-GTNH" ext.mineTweakerVersion = "3.2.3-GTNH"
if (System.getenv('BUILD_NUMBER') != null) if (System.getenv('BUILD_NUMBER') != null)
project.mineTweakerVersion += "."+System.getenv('BUILD_NUMBER') project.mineTweakerVersion += "."+System.getenv('BUILD_NUMBER')
else { else {
+3 -1
View File
@@ -1,2 +1,4 @@
org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Wed Oct 16 21:11:58 CEST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Vendored
+9 -17
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
############################################################################## ##############################################################################
## ##
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
warn () { warn ( ) {
echo "$*" echo "$*"
} }
die () { die ( ) {
echo echo
echo "$*" echo "$*"
echo echo
@@ -154,19 +154,11 @@ if $cygwin ; then
esac esac
fi fi
# Escape application args # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
save () { function splitJvmOpts() {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done JVM_OPTS=("$@")
echo " "
} }
APP_ARGS=$(save "$@") eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
# Collect all arguments for the java command, following the shell quoting and substitution rules exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+6
View File
@@ -49,6 +49,7 @@ goto fail
@rem Get command-line arguments, handling Windows variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@@ -59,6 +60,11 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line