The current API name is Level.setGameType. Since there's only one script that uses this API, I am not too worried about compatiability.
Edit: bonus question.
I want to switch gamemodes in-game. When switching gamemode, the player inventory isn't cleared automatically. Switching from survival into creative would result in a creative inv. with only survival contents; the other way around results in getting 5 of every item in the creative inventory.
Should I clear the inventory when switching gamemode? If so, how should this work?
DONT CLEAR THE INVENTORY. Use a simple array variable and store the contents of the survival inventory in it, so when you switch back, it adds all of those items into your inventory. It can still clear out the creative inventory though.level.setgamemode is better, level.setgametype should be something else though.OMG I JUST REALIZED 500 ISE=ZHUOWEI=BLOCKLAUNCHER AND OTHER APPS
DONT CLEAR THE INVENTORY. Use a simple array variable and store the contents of the survival inventory in it, so when you switch back, it adds all of those items into your inventory. It can still clear out the creative inventory though.
level.setgamemode is better, level.setgametype should be something else though.
OMG I JUST REALIZED 500 ISE=ZHUOWEI=BLOCKLAUNCHER AND OTHER APPS
OMG REALLY? LIKE OMG I TOTALLY THOUGHT THEY WERE DIFFERENT PEOPLE. LIKE WHO KNEW? 500ISE made the blocklauncher thread etc, its obvious.
Isn't Level.isCreative(boolean isCreative) the best?Add file in world dir to save survival inventory.
Also, according to reliable sources, Johan is making a new creative menu. Then the file saves also creative inventory (if there is)?
Rollback Post to RevisionRollBack
I can be found on Freenode IRC channels #pocketmine, #ModPEScripts, #LegendOfMCPE, #pmplugins or #BeaconMine.
I am a PocketMine-MP plugin developer. I hate it when people think that I love stupid admin positions. Being an admin is nothing compared to being a plugin developer.
I am also a main developer of BlockServer, a work-in-progress MCPE server software. You are welcome to download it, but it so far onlly spawns you in the upther (above the world). You can chat, though.
I do not own this server but I just love to put this banner here:
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThe current API name is Level.setGameType. Since there's only one script that uses this API, I am not too worried about compatiability.
Edit: bonus question.
I want to switch gamemodes in-game. When switching gamemode, the player inventory isn't cleared automatically. Switching from survival into creative would result in a creative inv. with only survival contents; the other way around results in getting 5 of every item in the creative inventory.
Should I clear the inventory when switching gamemode? If so, how should this work?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYeah Probably clearing the inventory is best, players can just store their survival items in a chest before switching
Check out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCheck out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCheck out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
var command = cmd.split(" ");
if(command[0] == "s") {
Level.setGameType(0);
clientMessage("Gamemode set to Survival.");
clientMessage("Please reload world.");
}
if(command[0] == "c") {
Level.setGameType(1);
clientMessage("Gamemode set to Creative.");
clientMessage("Please reload world.");
}
}
Mod made by Scary_Enderman
Why isn't this working?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumBecause I renamed Level.setGameType to Level.setGameMode?
Also, please don't copy-and-paste Scary_Enderman's mod without permission.
ok thanks. And I would of said who's mod it was but I didn't remember who made it but I'll edit that in
Also, according to reliable sources, Johan is making a new creative menu. Then the file saves also creative inventory (if there is)?