Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

robertx555's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. What is the purpose of this capability? Unless I understood you wrong, you just need other mods to tell you what elements their mobs are. This can be done with datapacks. You load all the datapacks into a Hashmap<String,ElementData> where string is the mod id. And when you want to know mob's resistances, you just check that map. Entity Capabilities are for saving mob specific data, a hashmap works fine if that data is set at startup and same for each mob type.
  2. Got it thanks. OP you can notify other mod's devs if there's other mods with this problem.
  3. I think I followed a tutorial or was suggested to render hud on ElementType.EXPERIENCE. What is the correct way to do it?
  4. Is this mod released somewhere? If so that's against my permission as i reserved all rights. I only allowed private use of modified code. Also the 1.12.2 version has a crapton of my spaghetti code which is mostly ironed out in 1.14.4 as i spent months reworking most things. Yes, months to rework things, so i don't suggest you try fix. Also sorry sieben for the problems.
  5. I know that at least. Btw managed to gitignore build and eclipse folders so here's the new one https://github.com/RobertSkalko/MMORPG-Mod Now i'm gonna see if i can use capabilities to save NBTTagCompound, i have like 20 stats so having 20 getter and setter functions seem like a disaster. Anyway it's nearly midnight so i'll do it tomorrow Thanks for the help! I won't need help anymore soon, got a lot of things to work on now!
  6. i know but things are easier to balance if i only care about 1 player.. for example say i want to spawn random mobs around a player. It becomes more difficult to balance when multiple players are around. 1 player is lvl 100 the other is lvl 1, i would have to make it so both players can play somehow.. which would mean many changes didn't learn that yet, i'll try gitignore, kept hearing about it but now i see why it's useful
  7. My tastes are niche so i wouldn't expect many to like the mod.. If i can easily make it multiplayer then sure Eclipse folder is 100 mb and build folder is 70 mb
  8. i'm making it for singleplayer only for now I'll try rework the getstats so it saves on capabilities, now that i have a working capability i can actually start the work sorry i just put the main files because the file is 200mb and my net is pretty slow
  9. my bad i'll first check for server side, um getstats is for calculating player stats that i made. I put the whole thing on github if you want to get eye damage Gonna take me a while to fix stuff after removing MAIN.player
  10. Whoa i think i solved it! Thanks! @SubscribeEvent public void onTickCalcStats(TickEvent.PlayerTickEvent event) { if (event.phase == Phase.END ) { tick++; if (tick > 100 && event.player != null && event.side.isServer()) { MAIN.player = event.player; EntityPlayer player = event.player; getStats(); if (player.hasCapability(Entity_Data.Data, null)) { DataInterface data = player.getCapability(Entity_Data.Data, null); data.setLevel(data.getLevel() +1); player.sendMessage( new TextComponentString(data.getLevel()+ " ")); } IAttributeInstance health = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); health.setBaseValue(20); tick = 0; } } } You said i'm supposed to get player from event.. well servertickevent has no player but TickEvent.PlayerTickEvent does! I changed it and it suddenly magically worked! It saves on death and on quitting game! That answered another question, seems i don't have to call any other saving methods I'm gonna go and remove MAIN.player and update all the stuff..
  11. How would i set the player data on the server? btw i uploaded to github in case it helps https://github.com/RobertSkalko/Minecraft-Forge-Singleplayer-MMORPG-like-mod
  12. MAIN.player = Minecraft.getMinecraft().player; I can post my whole mod on github in a sec but it contains a lot of shitty code that i'll have to revamp when i figure out how everything works
  13. I made a small test for it in servertickevent if (MAIN.player.hasCapability(Entity_Data.Data, null)) { DataInterface data = MAIN.player.getCapability(Entity_Data.Data, null); data.setLevel(data.getLevel() +1); MAIN.player.sendMessage( new TextComponentString(data.getLevel()+ " ")); Basically an increment every few ticks. I keep seeing increasing numbers.. until i leave game or die. It goes like 1,2,3,4 "i die" 1, 2 ,3 you get the idea. So either i have to save the data somehow or i messed something up with the compatibility
  14. Took me a while to get a working capability but now i don't see how i'm supposed to save them to disk. Here is my capability file, it's all registered and it works, just doesn't save public class Entity_Data { @CapabilityInject(DataInterface.class) public static final Capability<DataInterface> Data = null; public interface DataInterface { void setLevel(int value); int getLevel(); } public static class EventHandler { @SubscribeEvent public void onEntityConstruct(AttachCapabilitiesEvent evt) { evt.addCapability(new ResourceLocation(Ref.MODID, "Data"), new ICapabilitySerializable<NBTTagCompound>() { DataInterface inst = Data.getDefaultInstance(); @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { return capability == Data; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { return capability == Data ? Data.<T>cast(inst) : null; } @Override public NBTTagCompound serializeNBT() { return (NBTTagCompound)Data.getStorage().writeNBT(Data, inst, null); } @Override public void deserializeNBT(NBTTagCompound nbt) { Data.getStorage().readNBT(Data, inst, null, nbt); } }); } } public static class Storage implements IStorage<DataInterface> { @Override public NBTBase writeNBT(Capability<DataInterface> capability, DataInterface instance, EnumFacing side) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("level", instance.getLevel()); return nbt; } @Override public void readNBT(Capability<DataInterface> capability, DataInterface instance, EnumFacing side, NBTBase nbt) { NBTTagCompound tag = (NBTTagCompound) nbt; instance.setLevel(tag.getInteger("level")); } } public static class DefaultImpl implements DataInterface { private int level = 1; @Override public int getLevel() { return level; } @Override public void setLevel(int value) { this.level = value; } } Also i followed a tutorial on how to make player data persist through death but it doesn't work even though the chat message is sent as a confirmation the code ran @SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event){ if (!event.getEntityPlayer().world.isRemote) { event.getEntityPlayer().sendMessage(new TextComponentString("clone")); EntityPlayer player = event.getEntityPlayer(); DataInterface data = player.getCapability(Entity_Data.Data, null); DataInterface oldData = event.getOriginal().getCapability(Entity_Data.Data, null); data.setLevel(oldData.getLevel()); } } Thanks for any help!
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.