Jump to content

[1.8] Creating a coremod


AyyyyLmao

Recommended Posts

Hey, so I've been reading through this http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

And I want to create my own coremod to change some of the 1.8 player animations back to 1.7's style, example: blockhit, sneaking, damage etc.

But I don't know how to do this for 1.8 let alone 1.6.2 if I was using it, so I was wondering if anyone can give me some help or explain it in an easier way to understand.

Thanks.

Link to comment
Share on other sites

TL;DR: Don't

 

You should be able to accomplish this with the event system, although your biggest problem (regardless of what you do, codewise) is going to be doing the actual animations and rendering them.

 

But on the off-chance that the events fired are not sufficient for this, creating a coremod is a huge, huge headache.  You thought coding animations was hard?  Coding ASM is much harder.  Here's an example:

 

	private void patch(ClassNode classNode) {
	MethodNode method = ASMHelper.findMethod(classNode, "func_149674_a", VOID_TYPE, WORLD_TYPE, INT_TYPE, INT_TYPE, INT_TYPE, RANDOM_TYPE);
	InsnList patch = new InsnList();
	AbstractInsnNode absNode = findLast(RETURN, method.instructions);
	patch.add(new VarInsnNode(ALOAD, 1));
	patch.add(new VarInsnNode(ILOAD, 2));
	patch.add(new VarInsnNode(ILOAD, 3));
	patch.add(new VarInsnNode(ILOAD, 4));
	patch.add(new MethodInsnNode(INVOKESTATIC, "com/draco18s/hardlibcore/asm/HardLibPatcher", "eventFunc", getMethodDescriptor(VOID_TYPE, WORLD_TYPE, INT_TYPE, INT_TYPE, INT_TYPE)));
	method.instructions.insertBefore(absNode, patch);
}

 

I only changed the names of the methods in order to opaque the point of the patch.  Can you figure out what it does?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Runtime patching with ASM (what coremods do) is different to (and a lot harder than) compiling your code with MCP and dropping the modified classes into the Minecraft JAR.

 

You'll need to have a solid understand of the Java bytecode format and the ASM library to make a coremod, neither of which you're likely to learn here or in Forge tutorials. You'll need to find your own resources.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I don't know. You may be able to subscribe to and cancel

RenderPlayerEvent.Pre

and handle the player rendering yourself, but that may conflict with other mods that do the same thing. You may also be able to use the Render Player API mod to handle your animations.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

If it is just private field members, then use Reflection.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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