Everything posted by Differentiation
-
[SOLVED] [1.12.2] NBT writing/reading for List
I do, but then it resets anyways once I add an entry (run the command)
-
[SOLVED] [1.12.2] NBT writing/reading for List
Yeah, but where and when should I write the values?
-
[SOLVED] [1.12.2] NBT writing/reading for List
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
-
[SOLVED] [1.12.2] NBT writing/reading for List
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?
-
[1.12.2] Custom potion effects
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.
-
[SOLVED] [1.12.2] NBT writing/reading for List
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.
-
[SOLVED] [1.12.2] NBT writing/reading for List
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?
-
[SOLVED] [1.12.2] NBT writing/reading for List
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.
-
[SOLVED] [1.12.2] NBT writing/reading for List
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?
-
[SOLVED] [1.12.2] NBT writing/reading for List
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!
-
[SOLVED] [1.12.2] Accessing ops.json file crashes client
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.
-
Making recipes for other mods
Why not? Forge made these events for registering stuff, I thought...
-
Making recipes for other mods
Or you could just use Register<IRecipe> event.
-
[1.14.4] Check Damage Source
Check if LivingDeathEvent::getSource().getTrueSource() instanceof EntityPlayer. First make sure it's not null, otherwise you'd get Java NullPointerException.
-
Preventing the player from punching/attacking on left click
I think you can cancel MouseEvent when the player left clicks and that solves your issues. Since the client needs to be notified
-
Simple Summon Lightning on Right Click with Sword 1.12.2
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.
-
[1.12.2] Setting the OP Permission Level for server or specific GameProfile?
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!
-
[SOLVED] [1.12.2] EntityLiving and EntityLivingBase
Thanks!
-
[SOLVED] [1.12.2] EntityLiving and EntityLivingBase
Hey, I was wondering what entities classify as EntityLivingBase and what classify as EntityLiving. What are their differences? Thanks!
-
[1.12.2] Minecraft flying capability resets after player clone?
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!
-
[1.12.2] Capability data resets after logging out and back in
Yep, that solves the problem.
-
[1.12.2] Capability data resets after logging out and back in
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!
-
[1.12.2] Capability data resets after logging out and back in
Okay this is it: https://github.com/TheWoodenWizard/DC-mod
-
[1.12.2] Capability data resets after logging out and back in
I downloaded the command line and created the repository, but it says it couldn't find the repository...
-
[1.12.2] Capability data resets after logging out and back in
These are all the files that have to do with the topic https://github.com/TheWoodenWizard/DC-mod
IPS spam blocked by CleanTalk.