Everything posted by Elix_x
-
[1.8] Need help with Custom Projectile rendering
Only one question before i continue: HAVE YOU REGISTERED RENDERER? AND WHERE? (post registering it code)
-
Blender to Minecraft
No no no no no... All is simple: mc 1.8: blender=no. techne=yes. json=yes. mc 1.7.10: blender=yes. techne=yes. json=there's no.
-
Blender to Minecraft
One question before i continue: mc version? 1.7.10 or 1.8?
-
[1.7.10][SOLVED]Rotate tileentity model
Okay, so here's your code annotated with //== ==\\ to separate sections //== MAIN RENDER METHOD==\\ @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { int meta = te.getWorldObj().getBlockMetadata((int)x, (int)y, (int)z); World world = Minecraft.getMinecraft().theWorld; //== BEGGINING OF RENDERING ==\\ //== PUSHING NEXT MATRIX FOR WHOLE RENDERER==\\ //The PushMatrix tells the renderer to "start" doing something. GL11.glPushMatrix(); //This is setting the initial location. GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); //== TEXTURING==\\ ResourceLocation textures = (new ResourceLocation("earthmod:textures/models/blockPostHead.png")); Minecraft.getMinecraft().renderEngine.bindTexture(textures); //== PUSHING NEXT MATRIX FOR MODEL RENDERER==\\ GL11.glPushMatrix(); //== ANDJUSTING START POSROTSCALE==\\ GL11.glRotatef(180F, 0F, 0F, 1F); LogHelper.info("Block meta: " + meta); //== MODELLING==\\ this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); //== POPPING MATRIX FOR MODEL RENDERER==\\ GL11.glPopMatrix(); //== POPPING MATRIX FOR WHOLE RENDERER==\\ GL11.glPopMatrix(); }
-
[1.7.10][SOLVED]Rotate tileentity model
Is this class kind of copy-pasta or you don't understand what you write: The PushMatrix tells the renderer to "start" doing something. Here starts render section... Sorry, but i will not answer further questions, if you will not understand how it works. // is not just for fun!
-
[1.7.10][SOLVED]Rotate tileentity model
You call it in render section, before model... And i think that param names are self explanatory...
-
[1.7.10] [UNSOLVED] Problems with rendering item inside an Item???
@Shadowfacts Okay...
-
[1.7.10] [UNSOLVED] Problems with rendering item inside an Item???
Is it seriously so hard???
-
[1.7.10] How to write patch files???
Technically, 1st one makes no sense to insert more labels and return, if there's already if statement that i can use... Interesting thing by the way: i commented out all changes excluding 1st one and it crashes too. Same thing happens whenever i leave at least one method transformer...
-
[1.7.10] How to write patch files???
Okay, i'll watch video, but... 1) In onTick and setKeyBindState, i'm inserting my method call in main if statement, and in my method always return false. 2) In resetKeyBindingArrayAndHash i'm calling it like getter for hash to be cleared. 3) In costructor, i'm calling it like getter instance tu be put with id in hash. Changes: 1)From: if (p_74507_0_ != 0) To: if(KeyBindingHelper.onTick(id)) 2)From: hash.clearMap(); To: KeyBindingHelper.resetKeyBindingArrayAndHash(hash).clearMap(); 3)From: hash.addKey(p_i45001_2_, this); To: hash.addKey(id, KeyBindingHelper.register(id, this)); EDIT: i'll edit 3rd one...
-
[1.7.10] How to write patch files???
Well i'm back with another problems: I wrote transformer for KeyBinding, but when i start the game it crashes... Transformer class: public class KeysOverhaulTransformer implements IClassTransformer{ @Override public byte[] transform(String name, String transformedName, byte[] bytes) { if(name.equals(KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding"))){ System.out.println("##################################################"); System.out.println("Patching KeyBinding"); byte[] b = patchKeyBinding(name, bytes); System.out.println("Patching KeyBinding Completed"); System.out.println("##################################################"); return b; } return bytes; } private byte[] patchKeyBinding(String name, byte[] bytes) { String onTick = KeysOverhaulTranslator.getMapedMethodName(name, "func_74507_a", "onTick"); String setKeyBindState = KeysOverhaulTranslator.getMapedMethodName(name, "func_74510_a", "setKeyBindState"); String resetKeyBindingArrayAndHash = KeysOverhaulTranslator.getMapedMethodName(name, "func_74508_b", "resetKeyBindingArrayAndHash"); String init = "<init>"; ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); Iterator<MethodNode> methods = classNode.methods.iterator(); while(methods.hasNext()){ MethodNode method = methods.next(); if(method.name.equals(onTick)){ try{ System.out.println("**************************************************"); System.out.println("Patching onTick"); AbstractInsnNode currentNode = null; AbstractInsnNode targetNode = null; int place = -1; int index = -1; Iterator<AbstractInsnNode> iter = method.instructions.iterator(); while (iter.hasNext()) { index++; currentNode = iter.next(); if(currentNode.getOpcode() == Opcodes.ILOAD){ if(currentNode.getNext().getOpcode() == Opcodes.IFEQ){ targetNode = currentNode; place = index; break; } } } method.instructions.set(targetNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "code/elix_x/coremods/keysoverhaul/KeyBindingHelper", ".onTick", "(I)Z")); System.out.println("Patching onTick Completed"); System.out.println("**************************************************"); }catch(Exception e){ System.out.println("Patching onTick Failed With Exception:"); e.printStackTrace(); System.out.println("**************************************************"); } } if(method.name.equals(setKeyBindState)){ try{ System.out.println("**************************************************"); System.out.println("Patching setKeyBindState"); AbstractInsnNode currentNode = null; AbstractInsnNode targetNode = null; int place = -1; int index = -1; Iterator<AbstractInsnNode> iter = method.instructions.iterator(); while (iter.hasNext()) { index++; currentNode = iter.next(); if(currentNode.getOpcode() == Opcodes.ILOAD){ if(currentNode.getNext().getOpcode() == Opcodes.IFEQ){ targetNode = currentNode; place = index; break; } } } method.instructions.insertBefore(targetNode, createNewListAndFillWith(new VarInsnNode(Opcodes.ILOAD, 1), new MethodInsnNode(Opcodes.INVOKESTATIC, "code/elix_x/coremods/keysoverhaul/KeyBindingHelper", ".setKeyBindState", "(I,Z)Z"))); method.instructions.remove(targetNode); System.out.println("Patching setKeyBindState Completed"); System.out.println("**************************************************"); }catch(Exception e){ System.out.println("Patching setKeyBindState Failed With Exception:"); e.printStackTrace(); System.out.println("**************************************************"); } } if(method.name.equals(resetKeyBindingArrayAndHash)){ try{ System.out.println("**************************************************"); System.out.println("Patching resetKeyBindingArrayAndHash"); AbstractInsnNode currentNode = null; AbstractInsnNode targetNode = null; int place = -1; int index = -1; Iterator<AbstractInsnNode> iter = method.instructions.iterator(); while (iter.hasNext()) { index++; currentNode = iter.next(); if(currentNode.getOpcode() == Opcodes.GETSTATIC){ FieldInsnNode field = (FieldInsnNode) currentNode; /*System.out.println("Owner: " + field.owner.replace("/", ".") + " Searching for: " + KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding")); System.out.println("Name: " + field.name + " Searching for: " + KeysOverhaulTranslator.getMapedFieldName("client.settings.KeyBinding", "field_74514_b", "hash")); System.out.println("Desc: " + field.desc);*/ if(field.owner.replace("/", ".").equals(KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding")) && field.name.equals(KeysOverhaulTranslator.getMapedFieldName("client.settings.KeyBinding", "field_74514_b", "hash"))){ targetNode = currentNode; place = index; break; } } } method.instructions.insert(targetNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "code/elix_x/coremods/keysoverhaul/KeyBindingHelper", ".resetKeyBindingArrayAndHash", "(Lnet/minecraft/util/IntHashMap;)Lnet/minecraft/util/IntHashMap;")); System.out.println("Patching resetKeyBindingArrayAndHash Completed"); System.out.println("**************************************************"); }catch(Exception e){ System.out.println("Patching resetKeyBindingArrayAndHash Failed With Exception:"); e.printStackTrace(); System.out.println("**************************************************"); } } if(method.name.equals(init)){ try{ System.out.println("**************************************************"); System.out.println("Patching <init>"); AbstractInsnNode currentNode = null; AbstractInsnNode targetNode = null; int place = -1; int index = -1; Iterator<AbstractInsnNode> iter = method.instructions.iterator(); while (iter.hasNext()) { index++; currentNode = iter.next(); if(currentNode.getOpcode() == Opcodes.GETSTATIC){ FieldInsnNode field = (FieldInsnNode) currentNode; if(field.owner.replace("/", ".").equals(KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding")) && field.name.equals(KeysOverhaulTranslator.getMapedFieldName("client.settings.KeyBinding", "field_74514_b", "hash"))){ targetNode = currentNode; place = index; break; } } } method.instructions.remove(targetNode.getNext()); method.instructions.remove(targetNode.getNext()); System.out.println("(IL" + KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding") + ";)L" + KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding") + ";"); method.instructions.insert(targetNode, createNewListAndFillWith(new VarInsnNode(Opcodes.ILOAD, 2), new VarInsnNode(Opcodes.ILOAD, 2), new VarInsnNode(Opcodes.ALOAD, 0), new MethodInsnNode(Opcodes.INVOKESTATIC, "code/elix_x/coremods/keysoverhaul/KeyBindingHelper", ".register", "(IL" + KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding") + ";)L" + KeysOverhaulTranslator.getMapedClassName("client.settings.KeyBinding") + ";"))); System.out.println("Patching <init> Completed"); System.out.println("**************************************************"); }catch(Exception e){ System.out.println("Patching <init> Failed With Exception:"); e.printStackTrace(); System.out.println("**************************************************"); } } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(writer); return writer.toByteArray(); } private InsnList createNewListAndFillWith(Object... nodes) { InsnList list = new InsnList(); for(Object node : nodes){ if(node instanceof AbstractInsnNode){ list.add((AbstractInsnNode) node); } if(node instanceof InsnList){ list.add(list); } } return list; } } And console log + crash: [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:transform:26]: ################################################## [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:transform:27]: Patching KeyBinding [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:56]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:57]: Patching onTick [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:82]: Patching onTick Completed [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:83]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:94]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:95]: Patching setKeyBindState [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:121]: Patching setKeyBindState Completed [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:122]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:133]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:134]: Patching resetKeyBindingArrayAndHash [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:163]: Patching resetKeyBindingArrayAndHash Completed [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:164]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:174]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:175]: Patching <init> [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:226]: (ILnet.minecraft.client.settings.KeyBinding;)Lnet.minecraft.client.settings.KeyBinding; [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:229]: Patching <init> Completed [18:38:22] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer:patchKeyBinding:230]: ************************************************** [18:38:22] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 15.03.15 18:38 Description: Initializing game java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding at net.minecraft.client.settings.GameSettings.<init>(GameSettings.java:204) at net.minecraft.client.Minecraft.startGame(Minecraft.java:420) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) 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:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) at GradleStart.main(GradleStart.java:45) Caused by: java.lang.ClassNotFoundException: net.minecraft.client.settings.KeyBinding at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 12 more Caused by: java.lang.NegativeArraySizeException at org.objectweb.asm.Frame.merge(Frame.java:1343) at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1475) at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:834) at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:726) at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:412) at code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer.patchKeyBinding(KeysOverhaulTransformer.java:240) at code.elix_x.coremods.keysoverhaul.core.KeysOverhaulTransformer.transform(KeysOverhaulTransformer.java:29) at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ... 14 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.client.settings.GameSettings.<init>(GameSettings.java:204) at net.minecraft.client.Minecraft.startGame(Minecraft.java:420) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) 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:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) at GradleStart.main(GradleStart.java:45) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 783634056 bytes (747 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. GL Caps: Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: ~~ERROR~~ NullPointerException: null Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: ~~ERROR~~ NullPointerException: null [18:38:22] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\my\mcmodding\mods\toolscompressor\eclipse\.\crash-reports\crash-2015-03-15_18.38.22-client.txt Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
-
Forgotten how to register Events correctly o.O
Yep. And fml events are registered here FMLCommonHandler.instance().bus()...
-
[1.7.10] How to write patch files???
Remove field (can not to remove, nut it will be useless), and change 3 static methods and constructor like that:
-
[1.7.10] How to write patch files???
I know about gui, that using events i can take it over... But in this case i don't even need to modify gui... That way(with Gui event) should be far more better than using ASM, especially when what you need is replacing a field. Some mods can get an access to the hash field using reflection, and they will be crash at that point. So... don't use ASM for that. (It seems that you even know how to achieve what you want without ASM) As i said, i don't need to change ANYTHING in any GUI (for now), i just need to change 4 methods in KeyBinding (It's not GUI!!!) and that's all!!!
-
[1.7.10] [UNSOLVED] Problems with rendering item inside an Item???
Anybody has any ideas??? Please???
-
[1.7.10] How to write patch files???
So, i'm back because i need to decide what will be better to use... Here's 4 methods (and 1 private field without getter or setter) that needs to be modified and how: //REMOVE // private static final IntHashMap hash = new IntHashMap(); //ADD private static final Multimap<Integer, KeyBinding> keyId = HashMultimap.create(); public static void onTick(int id) { if (id != 0) { //REMOVE /*KeyBinding keybinding = (KeyBinding)hash.lookup(id); if (keybinding != null) { ++keybinding.pressTime; }*/ //ADD for(KeyBinding keybinding : keyId.get(id)){ if (keybinding != null) { ++keybinding.pressTime; } } } } public static void setKeyBindState(int id, boolean state) { if (id != 0) { //REMOVE /*KeyBinding keybinding = (KeyBinding)hash.lookup(id); if (keybinding != null) { keybinding.pressed = state; }*/ //ADD for(KeyBinding keybinding : keyId.get(id)){ if (keybinding != null) { keybinding.pressed = state; } } } } public static void resetKeyBindingArrayAndHash() { //REMOVE /*hash.clearMap(); Iterator iterator = keybindArray.iterator(); while (iterator.hasNext()) { KeyBinding keybinding = (KeyBinding)iterator.next(); hash.addKey(keybinding.keyCode, keybinding); }*/ //ADD keyId.clear(); Iterator iterator = keybindArray.iterator(); while (iterator.hasNext()) { KeyBinding keybinding = (KeyBinding)iterator.next(); keyId.put(keybinding.keyCode, keybinding); } } public KeyBinding(String desc, int id, String cat) { this.keyDescription = desc; this.keyCode = id; this.keyCodeDefault = id; this.keyCategory = cat; keybindArray.add(this); keybindSet.add(cat); //REMOVE // hash.addKey(p_i45001_2_, this); //ADD keyId.put(id, this); }
-
[1.7.10] How to write patch files???
I know about gui, that using events i can take it over... But in this case i don't even need to modify gui...
-
[1.7.10] [UNSOLVED] Problems with rendering item inside an Item???
By the way, i found this code in mc rendering classes... So why isn't it working???
-
[1.7.10] How to write patch files???
I could, the problem is this "id" system(and "one per id" mechanic) and that these 3 methods depend on "id", makes that last written key will be unpressed (for example), but others won't... Do you understand what will happen?
-
[1.7.10] How to write patch files???
Well all these 3 methods are using this set, if i change it to multimap (or create new somewhere else), i need or to redirect methods from somewhere or from there... Plus to make it compatible with other mods, <init> needs to be modified too...
-
[1.7.10] How to write patch files???
Well, long story: One time looking in game settings i saw that key bindings are stored in list, without beeing connected to id, so i got question: if so, why we can't put multiple key bindings on one key? (techically, they are not only red, but if you put multiple options, only one is executed). So i dug deeper, and found that in KeyBinding, IntHashMap is used to acces keys, and if we change this to Multimap for example, we will be able to set multiple keys to one key...
-
[1.7.10] Increase Player Movement Speed When Wearing Armor
Movement speed is stored in PlayerCapabilites, get it with player.capabilities and modify what you need inside...
-
WorldTickEvent Running Multiple Times
How about client and server? Modded dimensions??
-
[1.7.10] How to write patch files???
It might be easier (the class replacing part at least) but it will be highly incompatible with many other mods, depending on what class you replace. It just defies the entire point of a coremod. I'm modifying static methods in KeyBinding. I don't think that they (onTick, setKeyBindState, resetKeyBindingArrayAndHash) are used somewhere, but minecraft...
-
[1.8] TNT does not prime when I use my own sort of flint and steel. [SOLVED]
If you can't do this in rightclick method for block, use one for item. And vise versa. (I mean that if you can't change method in block, you can do this in method of same functionality in item. In this case it's onItemUse())
IPS spam blocked by CleanTalk.