mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-12 16:37:38 +00:00
Working
This commit is contained in:
1 parent
3b23776ec3
commit
111d7891d6
7 files changed
+15
-107
No files matched your search
@@ -9,10 +9,14 @@ import java.util.Map;
|
||||
public class ReplacementManager {
|
||||
private static final Map<ItemStackKey, ItemStackKey> replacementMap = new HashMap<>();
|
||||
|
||||
// Public API for adding replacements.
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static void addReplacement(Item itemIn, int metaIn, Item itemOut, int metaOut) {
|
||||
replacementMap.put(new ItemStackKey(itemIn, metaIn), new ItemStackKey(itemOut, metaOut));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static ItemStackKey getReplacement(Item itemIn, int metaIn) {
|
||||
return replacementMap.getOrDefault(new ItemStackKey(itemIn, metaIn), null);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.myname.mymodid;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
// Override CommonProxy methods here, if you want a different behaviour on the client (e.g. registering renders).
|
||||
// Don't forget to call the super methods as well.
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.myname.mymodid;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
// preInit "Run before anything else. Read your config, create blocks, items, etc, and register them with the
|
||||
// GameRegistry." (Remove if not needed)
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
Config.synchronizeConfiguration(event.getSuggestedConfigurationFile());
|
||||
|
||||
MyMod.LOG.info(Config.greeting);
|
||||
MyMod.LOG.info("I am " + Tags.MODNAME + " at version " + Tags.VERSION);
|
||||
}
|
||||
|
||||
// load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed)
|
||||
public void init(FMLInitializationEvent event) {}
|
||||
|
||||
// postInit "Handle interaction with other mods, complete your setup based on this." (Remove if not needed)
|
||||
public void postInit(FMLPostInitializationEvent event) {}
|
||||
|
||||
// register server commands in this event handler (Remove if not needed)
|
||||
public void serverStarting(FMLServerStartingEvent event) {}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.myname.mymodid;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class Config {
|
||||
|
||||
public static String greeting = "Hello World";
|
||||
|
||||
public static void synchronizeConfiguration(File configFile) {
|
||||
Configuration configuration = new Configuration(configFile);
|
||||
|
||||
greeting = configuration.getString("greeting", Configuration.CATEGORY_GENERAL, greeting, "How shall I greet?");
|
||||
|
||||
if (configuration.hasChanged()) {
|
||||
configuration.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.myname.mymodid;
|
||||
|
||||
import com.myname.mymodid.API.ReplacementManager;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraft.init.Items;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
|
||||
public class MyMod {
|
||||
|
||||
public static final Logger LOG = LogManager.getLogger(Tags.MODID);
|
||||
|
||||
@SidedProxy(clientSide = "com.myname.mymodid.ClientProxy", serverSide = "com.myname.mymodid.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
ReplacementManager.addReplacement(Items.iron_ingot, 0, Items.bow, 10);
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
// load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed)
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
// postInit "Handle interaction with other mods, complete your setup based on this." (Remove if not needed)
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
// register server commands in this event handler (Remove if not needed)
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
proxy.serverStarting(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.myname.mymodid;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
||||
@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
|
||||
@SuppressWarnings("unused")
|
||||
public class Postea {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.myname.mymodid.mixins;
|
||||
|
||||
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -44,11 +43,7 @@ public final class PosteaLoadingPlugin implements IEarlyMixinLoader, IFMLLoading
|
||||
public List<String> getMixins(Set<String> loadedCoreMods) {
|
||||
final List<String> mixins = new ArrayList<>();
|
||||
mixins.add("MixinItemStack");
|
||||
if (FMLLaunchHandler.side().isClient()) {
|
||||
// register client only mixins here,
|
||||
// that is mixins that target client classes
|
||||
// such as net.minecraft.client.Minecraft class
|
||||
}
|
||||
|
||||
return mixins;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user