Jump to content

Differentiation

Members
  • Posts

    606
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Differentiation

  1. I do, but then it resets anyways once I add an entry (run the command)
  2. Yeah, but where and when should I write the values?
  3. I don't know, it's whenever I create another MutedList (every time I run the command). I don't know how to really fix this. Now the entries all go in but when I leave (the server closes), enter, and run the command once more, all the previous entries are deleted and there's just this one. I could send the code if you'd like I'm not sure of a way to avoid that. And that ties back to the problem I had at the very beginning of this thread, a way to read and write the old values
  4. Okay, so I did everything and the command works. However, when I mute another player the file just replaces the entry that's in it with the one I just added. How do I fix this? Is this only an issue with using Player[number] test GameProfiles?
  5. Just make the subclass and override the necessary methods. Then make a registry class (which could be inside this one, doesn't matter) with @EventBusSubscriber annotation. Then, in this class, subscribe to Register<Potion> event, where you'd use the provided methods to register the option effect. It's similar to making normal items and blocks.
  6. I watched the tutorial on Gson and it seemed pretty easy, but how would I create multiple entries in one file? Other than that, everything else seems straight forward.
  7. I'll probably just copy UserList and UserListBans, etc. because it's pointless to do this from scratch I think... Can I attach a capability to MinecraftServer and have it save the list when I exit or something? Is there any other solution for this without making it too complicated?
  8. I want the mod to create it when the server starts for the first time, exactly like Minecraft does bans.json when on a dedicated server, and have it update every time an entry is added (a player is muted). I don't really know how to start a json file like that or what I need to do. Is there any help or tutorial or something I could get? It does, it bans the GameProfile, not EntityPlayer. I've tested this out and it works.
  9. Currently I have it being put in player capability, however, I want to be able to ban any GameProfile, even if its offline (like how banning does it). I thought of maybe creating a muted.json file, but I dont know how to do that. How would I add an entry to ops.json without the entry being opped, but instead muted?
  10. Hey, I'm trying to create a mute command that'll add entries to a list (similar to how MC does it for bans). I don't know if the NBT data (with a list of String values for muted player names) saves after server shutdown. Also, what do I attach the capability to? Do I need an interface and storage? I'm just confused as to how I'd do NBT with an ArrayList (NBT is already kind of confusing in and of itself). If anyone could help, that'd be appreciated. Thanks!
  11. Hey, I've been trying to OP a player with a specified permission level. So I just copied the code from PlayerList::addOp(GameProfile profile); and just tweaked the permission level. However, when I log on a dedicated server, the client crashes. Code blocks: https://pastebin.com/cjekvJU8 Note: in the paste, SERVER is FMLCommonHandler.instance().getMinecraftServerInstance(); Crash report: https://pastebin.com/xi9itUPp I guess it's because I'm accessing ops.json in the wrong way. If so, how would I access it to add an entry with a custom permission level?? Any help is appreciated. If you need more code, please let me know. Thanks! EDIT 1: Getting MinecraftServer instance from EntityLivingBase::getServer(); and instead of making an instance for the file, I access it from PlayerList.FILE_OPS. No crash report. Going to try custom command. EDIT 2: The command doesn't work. Is there anything I'm doing wrong? Am I not allowed to OP a player to an integer less than the OP permission level? EDIT 3: Oh oops, I'm creating a new instance of UserListOps... EDIT 4: Solved.
  12. Why not? Forge made these events for registering stuff, I thought...
  13. Or you could just use Register<IRecipe> event.
  14. Check if LivingDeathEvent::getSource().getTrueSource() instanceof EntityPlayer. First make sure it's not null, otherwise you'd get Java NullPointerException.
  15. I think you can cancel MouseEvent when the player left clicks and that solves your issues. Since the client needs to be notified
  16. Check for !World::isRemote. Also, EntityPlayer::rayTrace(double blockReachDistance, float partialTicks) has @SideOnly(Side.CLIENT) annotation, so you can't run it on server thread or you'll crash. Use World::rayTraceBlocks(Vec3d start, Vec3d end) instead. One more thing, make an instance of BlockPos instead of calling the same method three times.
  17. Hey, I'm trying to find a way to set a specific OP level for a GameProfile. Is there any way to do this? PlayerList::addOp(profile) simply adds an OP with permission level matching what the server permission level is. Also, is there a way to change the OP permission level on the server? Any help is appreciated. Thanks!
  18. Hey, I was wondering what entities classify as EntityLivingBase and what classify as EntityLiving. What are their differences? Thanks!
  19. Hey, I created a command (/fly) which allows the player to fly by setting PlayerCapabilities::allowFlying and PlayerCapabilities::isFlying to true on both the server- and client-side (send a packet). The command works perfectly. However, when the player logs out or respawns, the player can't fly. I did make sure to get the data from the old player and transfer to the new player on PlayerEvent.Clone, but nothing works. I think Minecraft detects if you're on survival and based on that, determines whether it should allow the player to fly or not. How would I fix this? Any help is appreciated. Thanks!
  20. Oooh, I think I know what I did wrong... I didnt read and write the NBT data on player clone for the ticks in DinocraftPlayerTicks class. And in my PlayerTickEvent, if the ticks = 0, then it sets the values to false... Thanks for the help!
  21. Okay this is it: https://github.com/TheWoodenWizard/DC-mod
  22. I downloaded the command line and created the repository, but it says it couldn't find the repository...
  23. These are all the files that have to do with the topic https://github.com/TheWoodenWizard/DC-mod
×
×
  • Create New...

Important Information

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