Jump to content

Nitoxym

Members
  • Posts

    20
  • Joined

  • Last visited

Posts posted by Nitoxym

  1. 3 minutes ago, diesieben07 said:

    Not easily, there's no event being fired. The way it works is that the health of the entity is synced to the client using EntityDataManager and the client starts doing the death animation if the health is <= 0.

    Ok thanks, but how can I be sure that the player killed the entity? I saw this mod, and they managed to do it, but I can't figure how: https://github.com/symt/zealot-counter/tree/1.2.2/src/main/java/io/github/symt

    What I know is that it only detects when the player one shot the mob

  2. 2 minutes ago, Animefan8888 said:

    Take a look at those two classes. CompoundNBT and CompressedStreamTools.

    Ok, i'll check docs for that

    2 minutes ago, Animefan8888 said:

    You can get the game directory by doing Minecraft.getInstance().gameDir but do note that this will not work on dedicated server.

    It is a client only mod (and personal tool) so no problems with that

    2 minutes ago, Animefan8888 said:

    Here is an example where I have used GSON to write JSON files. Though it might be too complicated for an example.

    Ok, thanks, i'm checking that!

  3. 9 hours ago, Animefan8888 said:

    Which part can you not figure out?
    How to use GSON to write Json to file?
    How to get the .minecraft file location?

    .minecraft, I might have an idea, but not sure, to use GSON, I have no idea, and I don't understand most of the posts

    9 hours ago, Animefan8888 said:

    If you want to use .dat I believe you need to store your data in a CompoundNBT then use net.minecraft.nbt.CompressedStreamTools to read and write your file when you need/want to.

    May I have any example please? Or any method to do this

  4. 9 hours ago, Animefan8888 said:

    First off where are you rendering at? Also what do you mean "center text"? In the exact middle of the screen? In the middle of the width, middle of the height. or even any other point on the screen?

    At the middle of the width and height, and I'm rendering in game

    And screenWidth is the width of the real screen, or the scaled one?

  5. 5 minutes ago, Animefan8888 said:

    You likely just need to use events to read and write the data. IE when the mod loads(FMLCommonSetupEvent) read the data from the file.

     

    And the GSON library is included within the Minecraft/Minecraft Forge project so you can use that to read and write JSON files.

    Ok perfect, and how can I do that?

  6. 2 minutes ago, Animefan8888 said:

    You want to through all worlds keep track of certain things?

    I need to store values, and keep them wherever I go, like a vanilla setting doesn't change on different world

    3 minutes ago, Animefan8888 said:

    If so you will need to write to a file yourself. Forge doesn't have anything for universal persistence that I know of. Though you can use basic IO or JSON(GSON) for stuff that is loaded and saved once.

    Does Forge support that? YML, JSON, .properties, is there a "vanilla" way to do that, or I have to create one myself?

  7. Hey!

    So I want to create a system that displays the number of a certain mob with a certain name, for example, a Creeper named "Creep". I know how to create the event, how to display the text, but what I need is a system that permit me to store the number value, and get it back even after game restart, any idea how to do this?

    I'm developing in 1.15.2

×
×
  • Create New...

Important Information

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