Jump to content

CreativeMD

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by CreativeMD

  1. I don't know the name, but i used names like a, ai or something like that, but i thought i could use this class "map" these names. Obviously this is not possible .
  2. but this does only work in m eclipse enviroment: public void replaceOnUpdateMethod(ClassNode node) { String targetMethodName = "onUpdate"; String targetDESC = "(Lnet/minecraft/entity/item/EntityItem;)V"; Iterator<MethodNode> methods = node.methods.iterator(); while(methods.hasNext()) { MethodNode m = methods.next(); if ((m.name.equals(targetMethodName) && m.desc.equals("()V"))) { m.instructions.clear(); m.instructions.add(new VarInsnNode(ALOAD, 0)); m.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/creativemd/itemphysic/physics/ServerPhysic", "update", targetDESC, false)); m.instructions.add(new InsnNode(RETURN)); } } } I think because it's not a real "link" to the method, but only a string.
  3. How? I will need that, too . FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(owner, name, desc); doesn't work , maybe i'm doing it wrong? I searched for these two files (fields.csv and methods.csv), but couldn't find it for 1.8 . Also i don't understand these lines: String prop = System.getProperty(SYS_PROP); if (prop == null) { mappingsDir = "./../build/unpacked/mappings/"; } else { mappingsDir = prop; } Does this also work outside of my eclipse environment?
  4. Hello, is there a way to "unmap" names of field/ method? Example: I'm using the "IClassTransformer" and want to edit the 2"onUpdate" ("()V") in "EntityItem". I can "unmap" EntityItem using this method: FMLDeobfuscatingRemapper.INSTANCE.map("net/minecraft/entity/item/EntityItem") but "unmapping" onUpdate is not possible... i can only map fields/methods FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(owner, name, desc); FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(owner, name, desc); So my question is: Is there a way to unmap Fields/Methods?
  5. A hack? WOW, why this thread "Suggestions" does even exits? Hm don't know. Sorry, but i'm a little bit pissed off. If you want people help you at forge, why do you act like that? Why you don't just be happy, someone wants make a better gui api (because the current doesn't even exits) or you could say sorry, but i don't think you are able to program something like that or i will take a look once you finished if i will implement it.
  6. Yes you are right, not every new library causes lag, but sometimes a forge way would improve that and what about the other two reasons? I know it sounds wired, but using my mod in a modpack causes minecraft to launch faster (in Windows), this is caused by the fact that a freezed window in windows is slower and please don't take it that serious, also like i said LexManos wanted to implement it.
  7. YEEEESSS, of course every modder could to this and ever modder can add his own core mod, which does all this things. BUT WHY? sorry i'm a little bit disappointed. This causes more lag more bugs and more time for the modders to update. Forge should do these things not the modders. ARG. Sorry, but this has to be said. Also i'm not really willing to to program those things and then to release they won't be added.
  8. - LexManos wanted to implement that (he asked for my source), also people loving the progressbar - i'm not talking about the game menu, but the ingame menu overlays like how much power a tool have or something like that. Also a minimap would be an overlay or a tooltip and so on. I think this would be very helpful for modders and prevent overlapping. - Here is an overview of the methods http://pastebin.com/sxXXYJGX, but there is no way to change size and rotation and there is not really a render 3d method using an ItemStack. Here is an example for 2D http://pastebin.com/Nb9nzkuL and 3d (isn't that complex and necessary) http://pastebin.com/vnEUwyCs. - I could add an api , if you don't have enough time for it. I already did something like that for my mod CraftingManager. Features could be: *prompt guis, *more and better guicontrols like (statebuttons, text fields, lists, scrollbars, etc.) *Using a standard gui background texture, draw slots and controls on them. Modders wouldn't have to draw a new image for every gui. *add a page view *i think you agree me that a gui api would be very helpful - ContainerAPI: *Less bugs from modders, *a really easy way to include SHIFT Click into the container, *better InventoryPlayer support, so that not every container has to copy and paste the add slot code, *methods like "onbuttonclicked" (button/controll has a boolean "sendtoSever"), *"tileEntityUpdateTick" represent how often an update tileentity packet is send 0: never; 0< time in ticks (the tileentity update packet does not equal the normal update packet necessarily: Furnace would only send the current progress), *new methods like "onSlotClicked" (example: to open a prompt), "getInteractRange()" *better IInventory system, IIventory change to class to add basic methods. Add a new interface for tileentities IAccessInventory (or something like that) which are easy to connect with each other. Example: public Inventory getInventory(Side){ if(side == up) return Inventory.getSlotRange(int start, int end)} <- is just an example *support pages -Example: Redstone alloywire, knows if it should connect or not and many other modder added redstone components. - Uniform equal things is always useful, you could need it for something. Here is a list of all methods that are needed to use the canBlockStay method (it's in BlockBush) http://pastebin.com/Hzqh5z3A why? it should be in an abstract block needGround (yes my names are bad) and this is only one example this could be done more often. Furnace doesn't extend BlockRotatedPillar, he has his own methods to calculate rotation. - Only recommend and tested forge version of course, this will not be to often i think 3 times in a minecraft version. It should help finding a forge version that every mod supports. In 1.7.2 this was almost impossible. - yes like i said huge changes, but may be very useful - maybe you are right but i don't see any. Thanks for taking time to read this , Time and work shouldn't be the problem, i will do it, if i'm sure forge will include it.
  9. Hello, here are my suggestions about what could be added/changed about forge: Note: I could add a pull request, but i first wanted to hear what you think about these ideas. - Improved Loading Screen (my Mod MinecraftLoader) and the ability for mods to render the screen using a function updateScreen(String Message), hope you know what i'm talking about - GuiOverlayRegistry (Many mods are adding an overlay for the ingame menu, a registry for that would be very useful, also the problem of overlapping what be fixed ) - Add a more simple way to render Items 3D and 2D, maybe something like a RenderHelper2Dand3D, example of a method could be renderItemIntoGUI(ItemStack stack, int posX, int posY, int rotation, boolean useInventoryTint ...) and the same for 3D. - a better gui, i hate the normal minecraft gui, a useful api/registry/utils would be so awesome, methods like getButtons, getTextFields or getControls would help. This should be huge and make it much more easy to add a gui in minecraft (of course this would be helpful for Containers as well). - The Container api, should also include a better IInventory class, everyone has to copy and paste methods like decrItemStack, this could be much much more easier. - block method "couldRecieveAnRedstoneSignal" - add more abstract blocks like "needGroundBlock" for plants etc., "rotationBlock" could be rotated in all direction or only "laterally" (actually there are many of abstract blocks which could be added, to uniform the blocks) - make the modders always update to the newest (recommend) forge version. You could do this by adding an update checker into the src-forge version, which stops starting minecraft if a new version is available. Of course an easy way to update the environment would be very great and i think also necessary. Huge Changes (not needed, but you could think about that) - make Block extending Item, this is now done by ItemBlock, but in my eyes not that useful - make more things public, many important fields/methods are private, why? An example: the field worldGenerators in GameRegistry. If modders want to modify this field they can using a transformer, but why so complicated?
  10. Hello, i'm working on a mod called VoiceChat, i almost finished everything, but i got problems to play the recorded sound . Is there a way to play an audio stream with forge? For more detailed information: http://www.paulscode.com/forum/index.php?topic=1728.0
  11. Thank you now everything works fine you are awesome
  12. Hello, I'm trying to port my mod CraftingManager to 1.7.2, i read this tutorial for packets: http://www.minecraftforge.net/wiki/Tutorials/Packet_Handling i did it almost the same way here are my classes CraftingPacket PacketDisabled Channel Register Sending Packet sendToPlayer & getDisabledPacket but something goes wrong , i have no idea why this error comes up: Can anyone help me? I tried everything, but this error comes up everytime
  13. I'm sad to tell this, but there is new error. My Code public byte[] replaceMethod(String name, byte[] bytes, File location, boolean obfuscated) { String targetMethodName = "doRender"; String targetDESC = "(Lnet/minecraft/entity/Entity;DDDFF)V"; String newDESC = "(Lnet/minecraft/entity/Entity;DDDFFZ)V"; String targetVar = "renderWithColor"; //Our target method if(obfuscated == true) { System.out.println("Obfuscated"); targetMethodName ="a"; targetDESC = "(Lqn;DDDFF)V"; newDESC = "(Lqn;DDDFFZ)V"; targetVar = "field_77024_a"; } //set up ASM class manipulation stuff. Consult the ASM docs for details ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); Iterator<MethodNode> methods = classNode.methods.iterator(); while(methods.hasNext()) { MethodNode m = methods.next(); System.out.println("Search in " + m.name + ": " + m.desc); if ((m.name.equals(targetMethodName) && m.desc.equals(targetDESC))) { System.out.println("********* Inside target method!"); AbstractInsnNode currentNode = null; @SuppressWarnings("unchecked") Iterator<AbstractInsnNode> iter = m.instructions.iterator(); while (iter.hasNext()) { currentNode = iter.next(); if (currentNode instanceof MethodInsnNode) { //m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETSTATIC, RenderItem.class.get, "renderInFrame", "Z")); m.instructions.insertBefore(currentNode, new VarInsnNode(ALOAD, 0)); //mv.visitVarInsn(ALOAD, 0); m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name.replace(".", "/"), targetVar, "Z")); ((MethodInsnNode) currentNode).desc = newDESC; ((MethodInsnNode) currentNode).owner = "com/creativemd/itemphysic/ItemDummyContainer"; ((MethodInsnNode) currentNode).setOpcode(INVOKESTATIC); } } m.visitEnd(); System.out.println("Patching Complete!"); break; } } System.out.println("Search in " + name); //ASM specific for cleaning up and returning the final bytes for JVM processing. ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); classNode.accept(writer); return writer.toByteArray(); } I tried to release this, but then this error comes up: ---- Minecraft Crash Report ---- // Quite honestly, I wouldn't worry myself about that. Time: 15.05.14 15:28 Description: Initializing game java.lang.NoClassDefFoundError: net/minecraft/client/renderer/entity/RenderItem at net.minecraft.client.gui.achievement.GuiAchievement.<init>(SourceFile:29) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:454) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:813) at net.minecraft.client.main.Main.main(SourceFile:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.entity.RenderItem at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 10 more Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: bpv at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source) at org.objectweb.asm.ClassWriter.a(Unknown Source) at org.objectweb.asm.Frame.a(Unknown Source) at org.objectweb.asm.Frame.a(Unknown Source) at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source) at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) at org.objectweb.asm.tree.ClassNode.accept(Unknown Source) at com.creativemd.itemphysic.ItemTransformer.replaceMethod(ItemTra nsformer.java:125) at com.creativemd.itemphysic.ItemTransformer.transform(ItemTransformer.java:54) at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ... 12 more I have no idea what is wrong
  14. Oh, sorry i thought this would be my home folder , thank you very very much.
  15. Sorry, but my .gradle folder only contains a folder named 1.11 and a file named gradle.log, sorry i search with the windows explorer a folder named "conf" but found nothing. What i'm doing wrong?
  16. Yes i'm able to read, but there is no folder called like that i only have a build folder , yes i don't build my mod, so this shouldn't be the problem EDIT Sorry, but i'm just a little bit disappointed and tired, so please forgive when i sound a little bit rude
  17. i need it for this: http://www.minecraftforge.net/forum/index.php/topic,19144.0.html And the tutorial says that it is possible in 1.7.2 "The below description for 1.6.x is mostly correct, but the modid_at.cfg should be placed in src/main/resources/ directly alongside your mcmod.info file. Also, the naming convention should be srg names and Forge packages. Refer to the forge_at.cfg for an example. It also support wildcards on both fields and methods" but i didn't understand how, i only need the information about the obfuscated names nothing more
  18. Hello, i can't find the files with the obfuscated names from that tutorial http://www.minecraftforge.net/wiki/Using_Access_Transformers. I have no clue had to get them can anybody help me, i read it for 10 times, but i still don't understand it .
  19. m.instructions.insertBefore(currentNode, new VarInsnNode(ALOAD, 0)); //mv.visitVarInsn(ALOAD, 0); m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name.replace(".", "/"), "renderWithColor", "Z")); ((MethodInsnNode) currentNode).desc = "(Lnet/minecraft/entity/item/EntityItem;DDDFFZ)V"; ((MethodInsnNode) currentNode).owner = "com/creativemd/itemphysic/ItemDummyContainer"; ((MethodInsnNode) currentNode).setOpcode(INVOKESTATIC); i only need to add this line , thank you very much. If this would be a getstatic this line before is not needed.
  20. You are completely right, but i found no tutorials . I know this is difficulty because i understand only 20% of what is going on, because of that i looked into that code also in variables of the instructions, but this was obviously not enough . So i would be very happy if you could give me a link to a tutorial and i also would be very happy if you could tell me why this is not working, isn't their a possibility to add instructions? Probably you don't understand it because you don't have enough information
  21. Basically i have no clue at all . I read the tutorial on replacing a vanilla method and start debugging the code and try to get an impression what is going on. So i just look at all variables and thought this could work. Changing the method like this: ((MethodInsnNode) currentNode).desc = "(Lnet/minecraft/entity/item/EntityItem;DDDFF)V"; ((MethodInsnNode) currentNode).owner = "com/creativemd/itemphysic/ItemDummyContainer"; ((MethodInsnNode) currentNode).setOpcode(INVOKESTATIC); does obviously work out . I installed a ByteCode plugin in my eclipse and look up how this method looks like. I recognized that the variables are "visited" before the method is called and after that they get an label like this mv = cw.visitMethod(ACC_PUBLIC, "doRender", "(Lnet/minecraft/entity/Entity;DDDFF)V", null, null); mv.visitCode(); Label l0 = new Label(); mv.visitLabel(l0); mv.visitLineNumber(756, l0); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitTypeInsn(CHECKCAST, "net/minecraft/entity/item/EntityItem"); mv.visitVarInsn(DLOAD, 2); mv.visitVarInsn(DLOAD, 4); mv.visitVarInsn(DLOAD, 6); mv.visitVarInsn(FLOAD, ; mv.visitVarInsn(FLOAD, 9); mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/client/renderer/entity/RenderItem", "doRender", "(Lnet/minecraft/entity/item/EntityItem;DDDFF)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(757, l1); mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLocalVariable("this", "Lnet/minecraft/client/renderer/entity/RenderItem;", null, l0, l2, 0); mv.visitLocalVariable("par1Entity", "Lnet/minecraft/entity/Entity;", null, l0, l2, 1); mv.visitLocalVariable("par2", "D", null, l0, l2, 2); mv.visitLocalVariable("par4", "D", null, l0, l2, 4); mv.visitLocalVariable("par6", "D", null, l0, l2, 6); mv.visitLocalVariable("par8", "F", null, l0, l2, ; mv.visitLocalVariable("par9", "F", null, l0, l2, 9); mv.visitMaxs(10, 10); mv.visitEnd(); So i tried to add a new parameter to the method by just adding this m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name.replace(".", "/"), "renderWithColor", "Z")); But this obviously don't work, i just look into m.instructions variable and tried to do it the same way. Yes and of course i changed the desc to that "(Lnet/minecraft/entity/item/EntityItem;DDDFFZ)V", but it's still not working. So hopefully this can help you to help me .
  22. Oh man your so right , of course i know this renderer, but i didn't thought about it. Anyways i have to do something similar again, so can you tell me what i'm doing wrong. I found out that i have to change this m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name, "renderWithColor", "Z")); to this m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name.replace(".", "/"), "renderWithColor", "Z")); but then this error comes up java.lang.VerifyError: (class: net/minecraft/client/renderer/entity/RenderItem, method: doRender signature: (Lnet/minecraft/entity/Entity;DDDFF)V) Expecting to find object/array on stack I would be very happy if you could help me with that
  23. Add this to your block class @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int posX, int posY, int posZ) { return AxisAlignedBB.getAABBPool().getAABB(posX+0.0D, posY+0.0D, posZ+0.0D, posX+1.0D, posY+0.05D, posZ+1.0D); }
  24. Hi, I read this tutorial: here I don't understand everything, so please don't blame me i'm stupid . I just thought this could work. I want to replace this: public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.doRender((EntityItem)par1Entity, par2, par4, par6, par8, par9); } with this ItemDummyContainer.doRender((EntityItem)par1Entity, par2, par4, par6, par8, par9, renderInFrame, renderWithColor); So for this i used this method: @Override public byte[] transform(String arg0, String arg1, byte[] arg2) { if (arg0.contains("net.minecraft.client.renderer.entity.RenderItem")) { System.out.println("********* INSIDE OBFUSCATED MINECRAFTLOADER TRANSFORMER ABOUT TO PATCH: " + arg0); arg2 = replaceMethod(arg0, arg2, ItemPatchingLoader.location, !arg0.contains("net.minecraft.client.renderer.entity.RenderItem")); return arg2; } public byte[] replaceMethod(String name, byte[] bytes, File location, boolean obfuscated) { String targetMethodName = "doRender"; //set up ASM class manipulation stuff. Consult the ASM docs for details ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); Iterator<MethodNode> methods = classNode.methods.iterator(); while(methods.hasNext()) { MethodNode m = methods.next(); if ((m.name.equals(targetMethodName) && m.desc.equals("(Lnet/minecraft/entity/Entity;DDDFF)V"))) { System.out.println("********* Inside target method!"); AbstractInsnNode currentNode = null; @SuppressWarnings("unchecked") Iterator<AbstractInsnNode> iter = m.instructions.iterator(); int index = -1; while (iter.hasNext()) { index++; currentNode = iter.next(); //Found it! save the index location of instruction FDIV and the node for this instruction if (currentNode instanceof MethodInsnNode) { m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETSTATIC, name, "renderInFrame", "Z")); m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name, "renderWithColor", "Z")); ((MethodInsnNode) currentNode).desc = "(Lnet/minecraft/entity/item/EntityItem;DDDFFZZ)V"; ((MethodInsnNode) currentNode).owner = "com/creativemd/itemphysic/ItemDummyContainer"; ((MethodInsnNode) currentNode).setOpcode(INVOKESTATIC); } } m.visitEnd(); System.out.println("Patching Complete!"); break; } } //ASM specific for cleaning up and returning the final bytes for JVM processing. ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); classNode.accept(writer); return writer.toByteArray(); } I just copy this code from the forum, but this part is programmed by myself: while (iter.hasNext()) { index++; currentNode = iter.next(); //Found it! save the index location of instruction FDIV and the node for this instruction if (currentNode instanceof MethodInsnNode) { m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETSTATIC, name, "renderInFrame", "Z")); m.instructions.insertBefore(currentNode, new FieldInsnNode(Opcodes.GETFIELD, name, "renderWithColor", "Z")); ((MethodInsnNode) currentNode).desc = "(Lnet/minecraft/entity/item/EntityItem;DDDFFZZ)V"; ((MethodInsnNode) currentNode).owner = "com/creativemd/itemphysic/ItemDummyContainer"; ((MethodInsnNode) currentNode).setOpcode(INVOKESTATIC); } } This inserts the new two fields (renderInFrame and renderWithColor) and changes the method. Like a said, i don't understand everything with is going on, but obviously this don't work, because this error comes up: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/entity/RenderItem ... Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.entity.RenderItem So hopefully i could give you an impression what is going on. I don't have an idea what is wrong. I would be very very happy if someone can help me EDIT I noticed that when i let the new two booleans, out it works , so the error caused by the insertBefore. I noticed that my two new FieldInNode have an index of 0 and doesn't fit into it. Thanks previously
×
×
  • Create New...

Important Information

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