Jump to content

M1kep

Members
  • Posts

    49
  • Joined

  • Last visited

Everything posted by M1kep

  1. But here is how I would attempt to go about it: import net.minecraftforge.event.ForgeSubscribe; import cpw.mods.fml.common.event.FMLPreInitializationEvent; public class EventHookContainerClass { @ForgeSubscribe public void FunctionNameHere(FMLPreInitializationEvent event) { //What you want to do here. } } And then in your mods Main class add: @Init public void load(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new EventHookContainerClass()); }
  2. What do you need to do this for?
  3. Can you show me what I'm doing wrong? Cause i understand the basics of java, I have a feeling this is a stupid mistake but I can't seem to figure out what I'm doing wrong, that tutorial page did not help make much sense of my current problem.
  4. Run a virus scan
  5. You don't specify which class holds this variable (since you don't specify it in the class where you call it). ExampleClass.ExampleStaticVariable exampleClassInstance.ExampleNonStaticVariable I dont really understand what you are trying to say
  6. So in my main class file i have: private final static Item DebugItem1 = new DebugItem1(5000, 1, CreativeTabs.tabMisc, 0, "DebugItem1"); So what do i need to do in my EventHook class to specify this?
  7. Look at the furnace code or the crafting table code, and see how they restrict you from placing an item in the output slot.
  8. Can you post the code for your snowball class?
  9. Ok,so thats not really the problem, my problem is that my event hook class does not know of my DebugItem1, so what should i do?
  10. So im trying to add a EventHook that checks if the player is using my item when they right click but i cant make the item stack in the if statement please help [spoiler=FoolsCraftMain] package m1kep.foolscraft.common; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; 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.network.NetworkMod; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "FoolsCraft", name = "FoolsCraft", version = "0.0.0.1") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class FoolsCraftMain { @Instance("FoolsCraft") public static FoolsCraftMain instance; // Items private final static Item DebugItem1 = new DebugItem1(5000, 1, CreativeTabs.tabMisc, 0, "DebugItem1"); @SidedProxy(clientSide = "m1kep.foolscraft.client.FoolsCraftClientProxy", serverSide = "m1kep.foolscraft.common.FoolsCraftCommonProxy") public static FoolsCraftCommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { } @Init public void load(FMLInitializationEvent event) { LanguageRegistry.addName(DebugItem1, "DebugItem - A"); MinecraftForge.EVENT_BUS.register(new EventHookContainerClass()); } @PostInit public static void postInit(FMLPostInitializationEvent event) { } } [spoiler=DebugItem1] package m1kep.foolscraft.common; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class DebugItem1 extends Item { public DebugItem1(int id, int maxStackSize, CreativeTabs tab, int texture, String name) { super(id); // TODO Auto-generated constructor stub setMaxStackSize(maxStackSize); setCreativeTab(tab); setUnlocalizedName(name); } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { World world = par3World; EntityPlayer ply = par2EntityPlayer; double posX = ply.lastTickPosX; double posY = ply.lastTickPosY; double posZ = ply.lastTickPosZ; System.out.println("X: " + posX); System.out.println("Y: " + posY); System.out.println("Z: " + posZ); System.out.println("Int 1: " + par4); System.out.println("Int 2: " + par5); System.out.println("Int 3: " + par6); System.out.println("Int 4: " + par7); System.out.println("Float 1: " + par8); System.out.println("Float 2: " + par9); System.out.println("Float 3: " + par10); System.out.println(Minecraft.getMinecraft().thePlayer.getItemInUse()); return false; } } [spoiler=EventHookContainerClass] package m1kep.foolscraft.common; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.PlayerInteractEvent; public class EventHookContainerClass { @ForgeSubscribe public void buildVillage(PlayerInteractEvent event) { if ((Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() == new ItemStack(DebugItem1))) { Minecraft.getMinecraft().thePlayer.setHealth(-1); } } }
  11. If you are using eclipse double clicking the variable will highlight it throughout the entire class allowing you to see wether it is used in math or a function.
  12. Wow, (facepalm) and thank you
  13. Oh, thank you , i will for sure try that out Wait, how would i get my item in the if statement? Its probably obvious but im drawing a blank. Because it is asking for an itemstack but my item is an item...
  14. Now i am running into a problem where it is returning both feet post, and eye pos. public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { World world = par3World; EntityPlayer ply = par2EntityPlayer; double posX = ply.lastTickPosX; double posY = ply.lastTickPosY; double posZ = ply.lastTickPosZ; System.out.println("X: " + posX); System.out.println("Y: " + posY); System.out.println("Z: " + posZ); System.out.println("Int 1: " + par4); System.out.println("Int 2: " + par5); System.out.println("Int 3: " + par6); System.out.println("Int 4: " + par7); System.out.println("Float 1: " + par8); System.out.println("Float 2: " + par9); System.out.println("Float 3: " + par10); return true; } This is what it outputs: 2013-05-12 15:02:17 [iNFO] [sTDOUT] X: 1573.8539209767246 2013-05-12 15:02:17 [iNFO] [sTDOUT] Y: 8.485128304470969 2013-05-12 15:02:17 [iNFO] [sTDOUT] Z: 35.771595298500344 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 1: 1574 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 2: 3 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 3: 35 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 4: 1 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 1: 0.03881836 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 2: 1.0 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 3: 0.87386703 2013-05-12 15:02:17 [iNFO] [sTDOUT] X: 1573.8539209767246 2013-05-12 15:02:17 [iNFO] [sTDOUT] Y: 6.865128299702597 2013-05-12 15:02:17 [iNFO] [sTDOUT] Z: 35.771595298500344 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 1: 1574 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 2: 3 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 3: 35 2013-05-12 15:02:17 [iNFO] [sTDOUT] Int 4: 1 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 1: 0.03881836 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 2: 1.0 2013-05-12 15:02:17 [iNFO] [sTDOUT] Float 3: 0.87386703
  15. SetBlock? How would i generate a village like that?
  16. Ok, so I am trying to get a feel of structure generations and what can be done with it and im trying to generate a village for example when you right click with an item called Generator1. Any suggestions on how to go about doing that?
  17. Hi, so I am trying to figure out how to use asm and coremods and I ran into a little problem, please help. Console Log 2013-05-10 18:05:20 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.5.686 for Minecraft 1.5.2 loading 2013-05-10 18:05:20 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) Client VM, version 1.6.0_43, running on Windows 7:x86:6.1, installed at D:\Program Files\Java\jdk1.6.0_43\jre 2013-05-10 18:05:20 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation 2013-05-10 18:05:20 [sEVERE] [ForgeModLoader] Unable to read the coremod jar file FoolsCraft.jar - ignoring java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:127) at java.util.jar.JarFile.<init>(JarFile.java:136) at java.util.jar.JarFile.<init>(JarFile.java:100) at cpw.mods.fml.relauncher.RelaunchLibraryManager.discoverCoreMods(RelaunchLibraryManager.java:358) at cpw.mods.fml.relauncher.RelaunchLibraryManager.handleLaunch(RelaunchLibraryManager.java:136) at cpw.mods.fml.relauncher.FMLRelauncher.setupHome(FMLRelauncher.java:172) at cpw.mods.fml.relauncher.FMLRelauncher.relaunchClient(FMLRelauncher.java:104) at cpw.mods.fml.relauncher.FMLRelauncher.handleClientRelaunch(FMLRelauncher.java:38) at net.minecraft.client.Minecraft.main(Minecraft.java:2236) at Start.main(Start.java:29) FoolsCraftLoadingPlugin package m1kep.foolscraft.asm; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; @TransformerExclusions({ "m1kep.foolscraft.asm" }) public class FoolsCraftLoadingPlugin implements IFMLLoadingPlugin { @Override public String[] getLibraryRequestClass() { // TODO Auto-generated method stub return null; } @Override public String[] getASMTransformerClass() { // TODO Auto-generated method stub return new String[] { "m1kep.foolscraft.asm.FoolsCraftAccessTransformer" }; } @Override public String getModContainerClass() { return "m1kep.foolscraft.asm.FoolsCraftModContainer"; } @Override public String getSetupClass() { // TODO Auto-generated method stub return null; } @Override public void injectData(Map<String, Object> data) { // TODO Auto-generated method stub } } FoolsCraftAccessTransformer package m1kep.foolscraft.asm; import java.io.IOException; import java.lang.reflect.Method; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import cpw.mods.fml.common.asm.transformers.AccessTransformer; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; public class FoolsCraftAccessTransformer extends AccessTransformer { private static FoolsCraftAccessTransformer instance; private static List mapFiles = new LinkedList(); public FoolsCraftAccessTransformer() throws IOException { super(); instance = this; // add your access transformers here! mapFiles.add("FoolsCraft_at.cfg"); Iterator it = mapFiles.iterator(); while (it.hasNext()) { String file = (String) it.next(); this.readMapFile(file); } } public static void addTransformerMap(String mapFileName) { if (instance == null) { mapFiles.add(mapFileName); } else { instance.readMapFile(mapFileName); } } private void readMapFile(String name) { System.out.println("Adding transformer map: " + name); try { // get a method from AccessTransformer Method e = AccessTransformer.class.getDeclaredMethod("readMapFile", new Class[] { String.class }); e.setAccessible(true); // run it with the file given. e.invoke(this, new Object[] { name }); } catch (Exception ex) { throw new RuntimeException(ex); } } } FoolsCraftModContainer package m1kep.foolscraft.asm; import java.util.Arrays; import com.google.common.eventbus.Subscribe; import net.minecraftforge.event.EventBus; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; import cpw.mods.fml.common.ModMetadata; import cpw.mods.fml.common.event.FMLServerStartingEvent; public class FoolsCraftModContainer extends DummyModContainer { public FoolsCraftModContainer() { super(new ModMetadata()); ModMetadata myMeta = super.getMetadata(); myMeta.authorList = Arrays.asList(new String[] { "KeepCalm" }); myMeta.description = "Only A Fool Would Play"; myMeta.modId = "FoolsCraft"; myMeta.version = "1.5.2"; myMeta.name = "FoolsCraft"; } public boolean registerBus(EventBus bus, LoadController controller) { bus.register(this); return true; } @Subscribe public void onServerStarting(FMLServerStartingEvent ev) { ev.getServer().worldServerForDimension(0).spawnHostileMobs = false; } } MANIFEST.MF Manifest-Version: 1.0 FMLCorePlugin: m1kep.foolscraft.asm.FoolsCraftLoadingPlugin FoolsCraft_at.cfg public aab/E # spawnHostileMobs The file directory of my jar is as follows META-INF MANIFEST.MF asm FoolsCraftModContainer.class FoolsCraftLoadingPlugin.class FoolsCraftAccessTransformer.class FoolsCraft_at.cfg
  18. Hi, I'm curious if anybody knows how i would go about editing the the skeloton class to do this, using asm, i understand kind of how asm works but i dont understand how i would go about doing this?
  19. Ok thank you :DD Id expect that forge would have documentation about that but i cant seem to find it
  20. Events? And sorry I wasn't aware that ASM was a java thing and not a forge thing, sorry Can you give any details about core mods?
  21. So I have a couple questions, what is the difference between the different types of mods(Coremod, "Normal" mod) and what can you do with one type but not the other Next question is what exactly are hooks, and how are they used, and for what are the most useful? And finally, Asm if somebody could try to explain it or link me to some resource that could be informative. If you know of somewhere that already says some of these things just post that if you'd rather that then answer it yourself. Thank you
  22. Still having problems, I have retried 4 times to no avail, is there anything else i can provide that would help me get help?
  23. After running install.cmd and opening eclipse i am greeted with the following errors: Project 'Minecraft' is missing required library: 'jars/bin/jinput.jar' Project 'Minecraft' is missing required library: 'jars/bin/lwjgl_util.jar' Project 'Minecraft' is missing required library: 'jars/bin/lwjgl.jar' Project 'Minecraft' is missing required library: 'jars/bin/minecraft.jar' Project 'Minecraft' is missing required library: 'lib/argo-3.2-src.jar' Project 'Minecraft' is missing required library: 'lib/asm-debug-all-4.1.jar' Project 'Minecraft' is missing required library: 'lib/bcprov-debug-jdk15on-148.jar' Project 'Minecraft' is missing required library: 'lib/bcprov-debug-jdk15on-148.jar' Project 'Minecraft' is missing required library: 'lib/scala-library.jar' All of the files are in the appropriate directories(Compared with friends install) Can anybody please help? Edit: Also the install.cmd gives no errors
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.