Jump to content

BlueSpud

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by BlueSpud

  1. I have a bipedal mob and I added the this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); to the entity's behavior and it runs at the plater in supersonic speeds. Anyone know whats wrong?
  2. I want to add a texture to an entity that uses the RenderBiped renderer. In 1.5, it was really simple, but its changed and I can't quite figure out how to do it in 1.6. any help would be appreciated.
  3. While I was updating my mod, I started re-implementing my obj loader and render code. I copy and pasted the code from my 1.5.2 version. Here is my code: @SideOnly(Side.CLIENT) public class ModelHand extends ModelBase { public IModelCustom hands; public ModelHand() { hands = AdvancedModelLoader.loadModel(reasources.INSTANCE.path+"models/lefthand2.obj"); } public void render() { GL11.glTranslatef(1,7.5F, -; GL11.glRotatef(20, 0, 0, 1); GL11.glRotatef(-40, 1, 0, 0); GL11.glRotatef(-80, 0, 1, 0); GL11.glScalef(100, 100, 100); hands.renderAll(); } } Even calling the render function won't render the model. Any help could be appreciated.
  4. I did some reading up, and I figured out the problem. My end goal was to replace a function in the jar with a function I can write anywhere in the rest of my mod. I achieved exactly what I needed to, thank you for all your help.
  5. After looking around more, I found I needed to add the environment parameters. I also found a tutorial, but I'm having trouble replacing the instructions. Here is the link: http://www.minecraftforum.net/topic/1854988-tutorial-152161-changing-vanilla-without-editing-base-classes-coremods-and-events-very-advanced/ If you could help, that would still be great. (PS I downloaded the bytecode addon for eclipse, but after a bit of trying, I haven't' had any luck ) I also changed my code from above, and here it is: package DHNCore.asm; import static org.objectweb.asm.Opcodes.FDIV; import java.io.IOException; import java.util.Iterator; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; import org.omg.CORBA.portable.InputStream; public class DHNTransformer implements net.minecraft.launchwrapper.IClassTransformer { public byte[] patch (String name, byte[] bytes, String obfname, String iFile, String rname) throws IOException { ClassNode cn = new ClassNode(); ClassReader cr = new ClassReader(bytes); java.io.InputStream in = DHNTransformer.class.getResourceAsStream("/DHNCore/asm/Methods.class"); ClassNode cnr = new ClassNode(); ClassReader crr = new ClassReader(in); crr.accept(cnr, 0); cr.accept(cn, 0); Iterator<MethodNode> methods = cn.methods.iterator(); Iterator<MethodNode> methodsr = cnr.methods.iterator(); MethodNode mnr = null; while (methodsr.hasNext()) { MethodNode temp = methodsr.next(); System.out.printf("Methods that can be used to replaced are: %s %n", temp.name); if (temp.name.equals("rname")) { mnr = temp; } } while(methods.hasNext()) { MethodNode mn = methods.next(); System.out.printf("METHOD FOUND: %s %n",mn.name); if (mn.name.equals(name) || mn.name.equals(obfname)) { //begin patching System.out.printf("Beginning the patching of the method %s %n",name); //patching jargin here mn.instructions = mnr.instructions; System.out.printf("Pathcing has been completed %n"); } } ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); cn.accept(cw); return cw.toByteArray(); } @Override public byte[] transform(String arg0, String arg1, byte[] arg2) { if (arg0.equals("bgy")) { System.out.println("Doing RenderPlayer transformers in a obfuscated environment"); } if (arg0.equals("net.minecraft.client.renderer.entity.RenderPlayer")) { System.out.println("Doing RenderPlayer transformers in a de-obfuscated environment"); try { return patch("renderFirstPersonArm", arg2, "","","renderFirstPersonArm"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return arg2; } }
  6. EDIT: I was able to make the coremod load by adding a command line load in Eclipse, but I still don't know how I would override functions, so I can change them completely. I do need base edits, I'm modifying several functions that Forge can't change. My problem is that the coremod won't load. I'm in eclipse, and here is all my code: Transformer package DHNCore.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 DHNAccessTransformer extends AccessTransformer { private static DHNAccessTransformer instance; private static List mapFiles = new LinkedList(); public DHNAccessTransformer() throws IOException { super(); instance = this; // add your access transformers here! mapFiles.add("DHN_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); } } } Loader package DHNCore.asm; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; @TransformerExclusions({"DHNCore.asm"}) public class DHNLoadingPlugin 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[] {"DHNCore.asm.DHNAccessTransformer"}; } @Override public String getModContainerClass() { // TODO Auto-generated method stub return "DHNCore.asm.DHNModContainer"; } @Override public String getSetupClass() { // TODO Auto-generated method stub return null; } @Override public void injectData(Map<String, Object> data) { // TODO Auto-generated method stub } } Mod Container package DHNCore.asm; import cpw.mods.fml.common.DummyModContainer; import java.util.Arrays; import java.util.Random; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; 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 DHNModContainer extends DummyModContainer { public DHNModContainer() { super(new ModMetadata()); /* ModMetadata is the same as mcmod.info */ ModMetadata myMeta = super.getMetadata(); myMeta.authorList = Arrays.asList(new String[] { "BlueSpud" }); myMeta.description = "Dishonored Core Mod"; myMeta.modId = "DHNCORE"; myMeta.version = "1.6.1"; myMeta.name = "Dishonored Core"; myMeta.url = ""; } public boolean registerBus(EventBus bus, LoadController controller) { bus.register(this); return true; } /* * Use this in place of @Init, @Preinit, @Postinit in the file. */ @Subscribe /* Remember to use the right event! */ public void onServerStarting(FMLServerStartingEvent ev) { ev.getServer().worldServerForDimension(0).spawnHostileMobs = false; System.out.printf("DHNCore has Loaded%n"); } } for the config I just copied the tutorial on the wiki # Tutorial Access Transformers. ########### THESE ARE DIFFERENT IN 1.4 ################ # Lines starting with a '#' are comments and aren't needed, although it's a good idea to label them so you know what changes what. # World # So to make a field public, put something like this: public abr.E # spawnHostileMobs # In 1.4, the above line would be "public xe.F" Manifest Manifest-Version: 1.0 FMLCorePlugin: DHNCORE.asm.DHNLoadingPlugin
  7. I want to modify some of the functions in the jar, but I know installing modified class files is a haste. I thought ASM transformers were what I needed, but I haven't had any luck. If someone could point me in the right direction, that would be greatly appreciated. Thanks.
  8. Is there any way to make an EntityMob path to a certain block? I noticed that there is a function: this.worldobj.getEntityPathToXYZ(); thanks.
  9. Thanks for the help, but to simplify things, i just used some trig and some separating axis theorem to make a bounding triangle and if the player is in it, the mob responds.
  10. Personally I like loading in the texture without an icon and just binding it. Not sure if there's a render item method however, but IMO that's much more manageable.
  11. Is the texture white, or transparent. Make sure that you put the texture in the right place. I think you need to put I in /mcp71/src/minecraft/textures/items/your file. The path you put in is the exact path from your zip or the src/minecraft/ folder.
  12. That seems pretty self-explanitory, but is the function tracePath to check the area for entities? If it ism is tx,etc the end of the ray? And I assume boarder size is how big I want it to be?
  13. You can get the currently equipped item of the player by using Minecraft.getMinecraft().thePlayer.getCurrentlyEquippedItem() I believe. This will return an ItemStack, and you can do what you wish with that.
  14. I am relatively new to java actually. I do alot of c and c++ usually, so I haven't, but if I am not correct this is what I think the code would be after you mentioning that: if (ray cast() == instanceof EntityPlayer) { //whatever I want } Would that be right, or maybe a bit different syntax?
  15. Make sure you have the render class too, it shouldn't matter for a test.(it will show up as a white cube) Here's some code to try: In you're main mod file: int entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(MynameArrow.class, "MynameArrow",entityID); EntityRegistry.registerModEntity(MynameArrow.class, "MynameArrow", 1, this, 0, 1, false); Try that and then put this in you're client proxy register renders (make sure you call it in the after you do these) RenderingRegistry.registerEntityRenderingHandler(MynameArrow.class, new MynameArrowRender()); MynameArrowRender is the render class, if you haven't made it, just leave this line out and test the entity first. Baby steps
  16. When you recompile your code, there's another batch file called "reob" or something- That reobfuscates it I always thought that was required to make it run to be honest you can use the startclient file to start the modded client, so-long as you have recompiled it.
  17. The vanilla code itself should have worked fine? Could you perhaps post the code that you copied and didn't work?
  18. Looks good, but can you give me an idea on how to test if the entity is a player?
  19. Hi, I would like to get a general idea what an entity could see, kinda create a field of vision. To do this i was planning to use ray casting, however I can't seem to find a good way to ray cast with mine craft, other than selecting blocks. If I were to check for only blocks, some of my calculations, I'm sure would be messed up. Thanks in advance.
  20. I made an entity recently too. Depending on what kind of entity you are making, the render parameters change. Try checking in the vanilla arrow files to see what it uses or look on the blaster rifle tutorial on the wiki for forge.
  21. You can find the block right clicked on with a Forge event. Heres some code: @ForgeSubscribe public void buildVillage(PlayerInteractEvent event) { if (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() == youritemid) { //event.x, event.y,event.z are the block coordinates for the block you right clicked on //your code for generating } }
  22. You can leave most of the default blender exports the same but MAKE SURE you select triangulate polygons. I'm curios why sculptris wouldn't work. Did you get that error trying to import it into minecraft of did it give you that in sculptris?
  23. If you're using blender, I think it has a smart UV unwrap. Some programs (I'm not sure if Blender does) have real-time 3-d paining. Sculptris, a sculpting program will do that for you. It will also make a UV map for you as well. You can just import an obj, without sculpting and UV map and paint, though I've never tried it. but sometimes, even though the paint might look nice, it may make a really funky UV map and it would be hard to edit it in photoshop per-say (the map would look like a mess but on the model would look fine). The best thing you could do is spend some time looking into this , but work more on the mod, then when you're done, make the textures. UV mapping is quite easy if you know what you're doing... but can be very time consuming. If you've never done it before, I would try doing the Sculptris thing as long as you don't want to edit the map after you make the texture.
×
×
  • Create New...

Important Information

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