Tons of changes:

- Added interface to game, client and server
- Added transformations
- Made ingredient conditions more practical to use, no longer requires imports
- Started implementation of event handling
- Moved commands and logic to the common API code
- Added common interface to MineTweaker recipes
- Added string methods
- Moved the logger from static value to static getter
- Fixed crashes on dedicated servers
- Fixed bracket resolution for <id:meta> values in 1.6.4
- Fixed scripts not being sent to multiplayer clients in 1.6.4
This commit is contained in:
Stan Hebben committed 2014-07-04 22:03:03 +02:00
1 parent 7f6235f30d
commit 115593efa5
131 files changed
+3215 -1930

No files matched your search

@@ -10,11 +10,20 @@ import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import minetweaker.MineTweakerAPI;
import minetweaker.runtime.providers.ScriptProviderMemory;
public class MCPacketHandler implements IPacketHandler {
public static final Charset UTF8 = Charset.forName("utf-8");
public static final String CHANNEL_SERVERSCRIPT = "MTServerScript";
public static final String CHANNEL_OPENBROWSER = "MTOpenBrowser";
@Override
public void onPacketData(INetworkManager manager,
@@ -23,9 +32,21 @@ public class MCPacketHandler implements IPacketHandler {
if (packet == null || packet.channel == null || packet.data == null) return;
if (packet.channel.equals(CHANNEL_SERVERSCRIPT)) {
System.out.println("Received script data: " + packet.data.length + " bytes");
MineTweakerAPI.tweaker.setScriptProvider(new ScriptProviderMemory(packet.data));
MineTweakerAPI.tweaker.rollback();
MineTweakerAPI.tweaker.load();
} else if (packet.channel.equals(CHANNEL_OPENBROWSER)) {
String url = UTF8.decode(ByteBuffer.wrap(packet.data)).toString().trim();
if(Desktop.isDesktopSupported()){
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(url));
} catch (IOException e) {
} catch (URISyntaxException e) {
}
}
}
}
}