diff options
| author | â€huajijam <strhuaji@gmail.com> | 2019-04-13 11:05:03 +0800 |
|---|---|---|
| committer | â€huajijam <strhuaji@gmail.com> | 2019-04-13 11:05:03 +0800 |
| commit | 98c00c93f331d6a4520fb207d015635d4a997ccb (patch) | |
| tree | 9859aad3fce4ced498edd23474c71b8d4cbb4aaa /src/main | |
| parent | d7fcfa0ad111a73ab29a2f3fcead3c45615bd6cc (diff) | |
| parent | 3ac6ce92d641fdaec86a1aa39a17250944931bcc (diff) | |
| download | GT5-Unofficial-98c00c93f331d6a4520fb207d015635d4a997ccb.tar.gz GT5-Unofficial-98c00c93f331d6a4520fb207d015635d4a997ccb.tar.bz2 GT5-Unofficial-98c00c93f331d6a4520fb207d015635d4a997ccb.zip | |
Automatic synchronization
Former-commit-id: 06caaed4ca97e13d334bb05cfdc2cc6020c199de
Diffstat (limited to 'src/main')
90 files changed, 5470 insertions, 360 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java b/src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java new file mode 100644 index 0000000000..f4b61a17ba --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/ASM/ASMUtils.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.ASM; + +import org.objectweb.asm.tree.MethodNode; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class ASMUtils { + + public static String matchAny(String toCompare, String... args) { + for (int i = 0; i < args.length; i++) { + if (toCompare.equalsIgnoreCase(args[i])) + return args[i]; + } + return ""; + } + + /** + * Call this Method twice, one time for the Descriptor and one time for the Name. + */ + public static boolean isCorrectMethod(MethodNode methodNode, String... args) { + for (int i = 0; i < args.length; i++) { + if (methodNode.name.equalsIgnoreCase(args[i]) || methodNode.desc.equalsIgnoreCase(args[i])) + return true; + } + return false; + } + + public static boolean writeClassToDisk(byte[] towrite, String Classname, String Path) { + try { + OutputStream os = new FileOutputStream(new File(Path + Classname + ".class")); + os.write(towrite); + } catch (IOException e) { + e.printStackTrace(); + return false; + } + return true; + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java new file mode 100644 index 0000000000..9c76b3dd82 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.ASM; + +import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; +import cpw.mods.fml.common.DummyModContainer; +import cpw.mods.fml.common.LoadController; +import cpw.mods.fml.common.ModMetadata; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.versioning.ArtifactVersion; +import cpw.mods.fml.common.versioning.DefaultArtifactVersion; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.ArrayList; +import java.util.List; + +public class BWCore extends DummyModContainer { + + public static final String BWCORE_NAME = "BartWorks ASM Core"; + public static final Logger BWCORE_LOG = LogManager.getLogger(BWCORE_NAME); + + public BWCore() { + super(new ModMetadata()); + ModMetadata metadata = getMetadata(); + metadata.modId = "BWCore"; + metadata.name = BWCORE_NAME; + metadata.version = "0.0.1"; + metadata.authorList.add("bartimaeusnek"); + metadata.dependants = getDependants(); + } + + @Subscribe + public void preInit(FMLPreInitializationEvent event) { + } + + @Override + public List<ArtifactVersion> getDependants() { + List<ArtifactVersion> ret = new ArrayList<ArtifactVersion>(); + ret.add(new DefaultArtifactVersion("ExtraUtilities", true)); + ret.add(new DefaultArtifactVersion(BartWorksCrossmod.MOD_ID, true)); + return ret; + } + + @Override + public boolean registerBus(EventBus bus, LoadController controller) { + bus.register(this); + return true; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java b/src |
