Jump to content

Recommended Posts

Posted

I want the mod I'm making to be very customizable by the user so when it loads I want it to check and if a file is present it will do something. I know I could use a config file to do something similar but I'd like to do something on a larger scale.  What would the correct file path be to find the files I want to check?

 

If I knew that I could then use something like this...

 

File f = new File("minecraft/forge/where/do/I/go");

if(f.exists()) {  }   

 

Does it start at the .minecraft folder and then go up? Is it different between the forge eclipse environment and actual game running environment? Also could I make it relative to the minecraft forge mods folder, that would be the easiest way because I can easily find my way from there.

 

And one more thing, will it have to go through all the steps to get to the %appdata% folder because I know that varies from computer to computer and if your using a launcher or not.

Posted

No, the base directory is the mod jar. (I'm not sure if minecraft.jar files are included.) I don't know how to find files within the .minecraft folder but without the jar... I'd look in the Configuration code to see how it's done.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

So if I had a setup like this...

modName > modDeveloper > folderA > folderB

And folderA contained fileA and folderB contained fileB

 

And fileA was testing for fileB I'd do this...

File f = new File("/modDeveloper/folderA/fileB.class");

Posted

So should that work in both the eclipse and normal environment? I tried using a .png so I didn't have to worry about the .class or .java difference and set it up pretty similar to my example but it didn't work. Another issue is that I'm using a folder instead of a .jar, would that make a difference?

Posted

It is. I did a little trial and error so I went into one of my render files for one of my projectiles and right under the load texture I pasted the whole new file f deal and cope the file path exactly, when I ran mine craft the console told me f.exists = false. So that leads me to believe there is something in the mine craft code that adds something to the beginning of the file path, I did a little digging and couldn't find anything. I'll try looking a little harder and looking at how the Item and Block file paths work but I'm not sure if I'll find what I'm looking for there.

Posted

Would there be a way to mimic the loadTexture code from rendering, turn it into a boolean value (If no texture is available false, if there is true) and put it in my core file. I would only be able to check images but that should still be fine.

Posted

Ok, I found my problem, the file was reading out of the mcl jars folder not the src folder. I found that out by using f2.mkdir() and then locating the directory it created.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • You would have better results asking a more specific question. What have you done? What exactly do you need help with? Please also read the FAQ regarding posting logs.
    • Hi, this is my second post with the same content as no one answered this and it's been a long time since I made the last post, I want to make a client-only mod, everything is ok, but when I use shaders, none of the textures rendered in RenderLevelStageEvent nor the crow entity model are rendered, I want them to be visible, because it's a horror themed mod I've already tried it with different shaders, but it didn't work with any of them and I really want to add support for shaders Here is how i render the crow model in the CrowEntityRenderer<CrowEntity>, by the time i use this method, i know is not the right method but i don't think this is the cause of the problem, the renderType i'm using is entityCutout @Override public void render(CrowEntity p_entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { super.render(p_entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); ClientEventHandler.getClient().crow.renderToBuffer(poseStack, bufferSource.getBuffer(ClientEventHandler.getClient().crow .renderType(TEXTURE)), packedLight, OverlayTexture.NO_OVERLAY, Utils.rgb(255, 255, 255)); } Here renderLevelStage @Override public void renderWorld(RenderLevelStageEvent e) { horrorEvents.draw(e); } Here is how i render every event public void draw(RenderLevelStageEvent e) { for (HorrorEvent event : currentHorrorEvents) { event.tick(e.getPartialTick()); event.draw(e); } } Here is how i render the crow model on the event @Override public void draw(RenderLevelStageEvent e) { if(e.getStage() == RenderLevelStageEvent.Stage.AFTER_ENTITIES) { float arcProgress = getArcProgress(0.25f); int alpha = (int) Mth.lerp(arcProgress, 0, 255); int packedLight = LevelRenderer.getLightColor(Minecraft.getInstance().level, blockPos); VertexConsumer builder = ClientEventHandler.bufferSource.getBuffer(crow); Crow<CreepyBirdHorrorEvent> model = ClientEventHandler .getClient().crow; model.setupAnim(this); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, packedLight, OverlayTexture.NO_OVERLAY, alpha); builder = ClientEventHandler.bufferSource.getBuffer(eyes); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, 15728880, OverlayTexture.NO_OVERLAY, alpha); } } How i render the model public static void renderModelInWorld(Model model, Vector3f pos, Vector3f offset, Camera camera, PoseStack matrix, VertexConsumer builder, int light, int overlay, int alpha) { matrix.pushPose(); Vec3 cameraPos = camera.getPosition(); double finalX = pos.x - cameraPos.x + offset.x; double finalY = pos.y - cameraPos.y + offset.y; double finalZ = pos.z - cameraPos.z + offset.z; matrix.pushPose(); matrix.translate(finalX, finalY, finalZ); matrix.mulPose(Axis.XP.rotationDegrees(180f)); model.renderToBuffer(matrix, builder, light, overlay, Utils .rgba(255, 255, 255, alpha)); matrix.popPose(); matrix.popPose(); } Thanks in advance
    • Same issue - I have no idea
    • I am trying to develop a modpack for me and my friends to use on our server. Does anyone know how to develop a modpack for a server or could they help take a look at my modpack to potentially help at all?
    • un server de armas realista.  
  • Topics

×
×
  • Create New...

Important Information

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