Jump to content

daafganggdg

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by daafganggdg

  1. ok, would (System.getProperty("user.dir") + "\mods\MyMod.jar") be my jar file? Is it possible to acces a jar file?
  2. I'v never compiled my mod yet so I'm not too sure how it would look like But could I use (System.getProperty("user.dir") + "\MyMod\assets\mymod") to always find my Mods folder?
  3. In that one: C:\Users\User\AppData\Roaming\.minecraft\versions\1.7.2\1.7.2.jar ?
  4. Hey guys, Once my mod is installed it will need to now the path of my records, (currently assets/mymod/sounds/records) I'v used System.getProperty("user.dir") to get the path of minecraft, wich is the eclipse folder and in the real minecraft probably roaming/.minecraft, sooo what I actually need to know is where will all my assets and stuff be when I wanna run my mod in the original minecraft? I think you can costumize where MC is installing everything so my mod just needs to find out where it is?! (My english sucks, hope you know what i mean ^^)
  5. Correct me if I'm wrong, but I think you'v got to use &&, or the if statement will always return true like that. In my opinion the for loops make it actually just look more confusing, but yeah, just my opinion ^^
  6. You could go with something like this: @Override public void updateTick(World world, int x, int y, int z, Random rand){ if(world.getBlock(x+1, y, z) != Blocks.air) { world.setBlock(x+1, y, z, yourVirusBlock); } if(world.getBlock(x-1, y, z) != Blocks.air) { world.setBlock(x-1, y, z, yourVirusBlock); } if(world.getBlock(x, y+1, z) != Blocks.air) { world.setBlock(x, y+1, z, yourVirusBlock); } if(world.getBlock(x, y-1, z) != Blocks.air) { world.setBlock(x, y-1, z, yourVirusBlock); } if(world.getBlock(x, y, z+1) != Blocks.air) { world.setBlock(x, y, z+1, yourVirusBlock); } if(world.getBlock(x, y, z-1) != Blocks.air) { world.setBlock(x, y, z-1, yourVirusBlock); } } but make sure to put this.setThickRandomly(true) into the constructor ^^
  7. Just so i get it right, you want, for example if a virus block is next to an iron block, the iron block to become a virus bock?
  8. So, the class thats used for records is called ItemRecord. The constructor is protected, so you have to make your own class and extend it from ItemRecord. You can override: ResourceLocation getRecordResource(String name) to change the music, it's NOT the .ogg file I'm pretty sure, but the sounds.json, but there I'm stuck too, on how u do it correctly ^^
  9. Nah, I know how to write a text file but isn't there a better format?
  10. b) I'v already tried using a txt File, but that is kind of wierd.
  11. Uuhm, is there also a way to store the same data for all worlds?
  12. I deleted the old class and made a new one, actually exactly the same, but it seems to be working now.. Thanks a lot
  13. I didn't knew I have to.. But if I do, I get an error instead of null, sayin: Failed to instantiate SaveStuffThing java.lang.RuntimeException
  14. Ok, looks a lot better now but still not working :'( What I don't understand is, since the if statement is checking if the data equals null, and only then saves it, if (data == null) { data = new SaveStuffThing(); world.mapStorage.setData(IDENTIFIER, data); } How would it be able to save my String?
  15. Added it but still not working correctly I feel like my code is complete bullshit, but I don't know how to do it otherwise: SaveStuffThing saveData = new SaveStuffThing(); saveData.setMyString("HeyYoThatsMyString"); SaveStuffThing.set(world, saveData); } SaveStuffThing saveData = SaveStuffThing.get(world); System.out.print(saveData.getMyString()); } public class SaveStuffThing extends WorldSavedData{ private static final String IDENTIFIER = "MyModId"; String myString; public SaveStuffThing() { super(IDENTIFIER); } @Override public void readFromNBT(NBTTagCompound nbt) { this.myString = nbt.getString("anything"); } @Override public void writeToNBT(NBTTagCompound nbt) { nbt.setString("anything", this.myString); } public String getMyString() { return this.myString; } public void setMyString(String myString) { this.myString = myString; this.markDirty(); } public static SaveStuffThing get(World world) { SaveStuffThing data = (SaveStuffThing)world.mapStorage.loadData(SaveStuffThing.class, IDENTIFIER); if (data == null) { data = new SaveStuffThing(); world.mapStorage.setData(IDENTIFIER, data); } return data; } public static void set(World world, SaveStuffThing saveData) { world.mapStorage.setData("MyModId", saveData); } } What's wrong?
  16. I'v put a getter and setter in the WordSavedData public class SaveStuffThing extends WorldSavedData{ private static final String IDENTIFIER = "MyModId"; String myString; public SaveStuffThing() { super(IDENTIFIER); } @Override public void readFromNBT(NBTTagCompound nbt) { // this.myString = nbt.getString("anything"); } @Override public void writeToNBT(NBTTagCompound nbt) { nbt.setString("anything", this.myString); } public String getMyString() { return this.myString; } public void setMyString(String myString) { this.myString = myString; } public static SaveStuffThing get(World world) { SaveStuffThing data = (SaveStuffThing)world.mapStorage.loadData(SaveStuffThing.class, IDENTIFIER); if (data == null) { data = new SaveStuffThing(); world.mapStorage.setData(IDENTIFIER, data); } return data; } public static void set(World world, SaveStuffThing saveData) { world.mapStorage.setData("MyModId", saveData); } } The if (data == null) seems to resolve the NullPointerException, (it now returns null, wich is still not what i want, but at least not a crash ^^) I uncommented the line in readFromNBT and nothing changes (still gettin my String, but null after reconnecting) so I think the error might be there..
  17. put this in your main file MinecraftForge.EVENT_BUS.register(new TheClassWhereYouHaveYouExperienceStuff());
  18. java.lang.NullPointerException: Unexpected error and why is my code broken?
  19. So, I found the world.mapStorage.setData("MyData", saveData); and removed it. My bad When i now do the saving and then the loading It says HeyYoThatsMyString, but when i do the saving, close and open minecraft again, then do the loading, it just crashes?
  20. w8 hold on dont say anything
  21. So, I changed it to: public class SaveStuffThing extends WorldSavedData{ String myString; public SaveStuffThing(String mapName) { super(mapName); } @Override public void readFromNBT(NBTTagCompound nbt) { this.myString = nbt.getString("anything"); } @Override public void writeToNBT(NBTTagCompound nbt) { nbt.setString("anything", this.myString); } public String getMyString() { return this.myString; } public void setMyString(String myString) { this.myString = myString; } } The loading: SaveStuffThing saveData = new SaveStuffThing("ModID"); world.mapStorage.setData("MyData", saveData); saveData = (SaveStuffThing) world.mapStorage.loadData(SaveStuffThing.class, "MyData"); System.out.print(saveData.getMyString()); And saving: SaveStuffThing saveData = new SaveStuffThing("ModID"); saveData.setMyString("HeyYoThatsMyString"); world.mapStorage.setData("MyData", saveData); but I only get nullnull in the Console
  22. Sooo, I was trying around a bit.. (at least not gettin any errors ) SaveStuffThing saveData = new SaveStuffThing(""); NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("MyString", "Whatever"); saveData.writeToNBT(nbt); world.mapStorage.setData("MyData", saveData); and my class public class SaveStuffThing extends WorldSavedData{ public SaveStuffThing(String mapName) { super(mapName); } @Override public void readFromNBT(NBTTagCompound var1) { } @Override public void writeToNBT(NBTTagCompound var1) { } } What's the mapName doing? It's never getting used in SaveWorldData.. Is this going in the right direction? How can I load the String?
  23. What's actually the difference between @Override public Item getItemDropped(int i, Random rand, int h) { return Item.getItemFromBlock(Blocks.cobblestone); } and public Item getItemDropped(int i, Random rand, int h) { return Item.getItemFromBlock(Blocks.cobblestone); } It's both overriding the Method and dropping cobblestone, so what is the @Override doing?
  24. I want same data for all dimensions, so I'm going to use this? world.mapStorage.setData("MyData", ); world.mapStorage.loadData(, "MyData"); So, this requires 2 parameters, The first one is I guess the ID!? and the second one the WorldSaveData, but im not too sure what i do have to put there? (just want to save 1 string); And do I have to make a class like in the example too? (don't really know what I would do with it)
  25. Exact, how can I do this?
×
×
  • Create New...

Important Information

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