Hey guys! How often are you making an adventure maps and writing out that one sign: Do not break or place blocks! Well fear no more! With this quick customizable mod, you can finally finish that map without worries of the player cheating! In this ModPE template, you can decide what blocks the player may break with what tools (if you want them to), and decide if the player may place blocks. This also includes changing gamemode commands. Including survival, creative, adventure, and spectator mode (just type /survival or /creative or /adventure or /spectator).Here it is!
var adventureMode=true;
function destroyBlock(x, y, z, side){
if(adventureMode==true){
preventDefault();
// Don't change above
// Change below to make exeptions
for(allIds = 0; allIds<512; allIds++){
var itemId = 0; // item id. if u don' want a specified item, put as allIds
var blockId = 0; // block id. if u dont want a specified block, put as allIds
// making both variables equal to allIds will cause the player to be able to break a block only if they are carrying it in their hand. ex: carry dirt block, can break dirt blocks.
if(getCarriedItem() == itemId && getTile(x, y, z) == blockId){
Level.destroyBlock(x, y, z, true);
}
}
}
}
//Here's an example: if i said var itemId = 256 and then i said var blockId = 2 then if you are carying an iron shovel you can only destroy grass blocks
//To make more than one exeption use an or statement within the if statement and add new variables such as blockId2, or just write in the id directly.
var placeBlocks=false; //Do you wish the player to place blocks? true/false
function useItem(x, y, z, itemId, blockId, side, data){
if(adventureMode==true&&placeBlocks==false){
preventDefault();
}
}
function procCmd(cmd){
switch(cmd){
case"survival":
Level.setGameMode(0);
adventureMode=false;
clientMessage("survival mode");
break;
case"creative":
Level.setGameMode(1);
adventureMode=false;
clientMessage("creative mode");
break;
case"adventure":
Level.setGameMode(0);
adventureMode=true;
clientMessage("adventure mode");
break;
case"spectator":
Level.setGameMode(1);
adventureMode=true;
clientMessage("spectator mode");
break;
}
}
Feel free to modify this and make your own!
Mod Download: http://adf.ly/pdnWA
You seem pretty good with JS, n1 +1. I have a version which is not so complicated
var adventure = true;
function destroyBlock(x, y, z, side){
if(adventure){
preventDefault();
}
}
function useItem(x, y, z, side){
if(adventure){
preventDefault();
}
}
You seem pretty good with JS, n1 +1. I have a version which is not so complicated
var adventure = true;
function destroyBlock(x, y, z, side){
if(adventure){
preventDefault();
}
}
function useItem(x, y, z, side){
if(adventure){
preventDefault();
}
}
This is just a simple 1, not so complicated
Yes, that is true, but in the one I made, you can make exceptions. Say you are making an adventure map and want the player to find a wooden shovel or something before destroying sand blocks. He won't be able to destroy them with his hand or any other object, just the shovel. But yea, I guess if people don't want that they can use yours
Edit, yes now that I look at it this is overly complicated. Made this a while back.
Edit, I fixed it, thanks
Haha You can also make a spectator mod, adventure mode in creative! Can you also add commands to change the gamemode? E.g. Adventure Mode is 2, Spectator mode is 3!
Rollback Post to RevisionRollBack
It has been FUN modding, but everything has an end. I've quitted modding! Good Luck & Have Fun! ;D
Haha You can also make a spectator mod, adventure mode in creative! Can you also add commands to change the gamemode? E.g. Adventure Mode is 2, Spectator mode is 3!
yea, that would be super easy, good idea
Edit, I just decided to throw it in with this mod. Why not.
I didnt thought that you would do this lol. I got another way. But your way is easier to understand. Why dont you put this code into a file for download?
Rollback Post to RevisionRollBack
It has been FUN modding, but everything has an end. I've quitted modding! Good Luck & Have Fun! ;D
You seem pretty good with JS, n1 +1. I have a version which is not so complicated
var adventure = true;
function destroyBlock(x, y, z, side){
if(adventure){
preventDefault();
}
}
function useItem(x, y, z, side){
if(adventure){
preventDefault();
}
}
This is just a simple 1, not so complicated
function destroyBlock(x, y, z, s){
preventDefault();
}
function useItem(x, y, z, i, b, s){
preventDefault();
}
or even
function destroyBlock(x, y, z, s){preventDefault();}
function useItem(x, y, z, i, b, s){preventDefault();}
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
var adventureMode=true; function destroyBlock(x, y, z, side){ if(adventureMode==true){ preventDefault(); // Don't change above // Change below to make exeptions for(allIds = 0; allIds<512; allIds++){ var itemId = 0; // item id. if u don' want a specified item, put as allIds var blockId = 0; // block id. if u dont want a specified block, put as allIds // making both variables equal to allIds will cause the player to be able to break a block only if they are carrying it in their hand. ex: carry dirt block, can break dirt blocks. if(getCarriedItem() == itemId && getTile(x, y, z) == blockId){ Level.destroyBlock(x, y, z, true); } } } } //Here's an example: if i said var itemId = 256 and then i said var blockId = 2 then if you are carying an iron shovel you can only destroy grass blocks //To make more than one exeption use an or statement within the if statement and add new variables such as blockId2, or just write in the id directly. var placeBlocks=false; //Do you wish the player to place blocks? true/false function useItem(x, y, z, itemId, blockId, side, data){ if(adventureMode==true&&placeBlocks==false){ preventDefault(); } } function procCmd(cmd){ switch(cmd){ case"survival": Level.setGameMode(0); adventureMode=false; clientMessage("survival mode"); break; case"creative": Level.setGameMode(1); adventureMode=false; clientMessage("creative mode"); break; case"adventure": Level.setGameMode(0); adventureMode=true; clientMessage("adventure mode"); break; case"spectator": Level.setGameMode(1); adventureMode=true; clientMessage("spectator mode"); break; } }Feel free to modify this and make your own!
Mod Download: http://adf.ly/pdnWA
var adventure = true; function destroyBlock(x, y, z, side){ if(adventure){ preventDefault(); } } function useItem(x, y, z, side){ if(adventure){ preventDefault(); } }This is just a simple 1, not so complicatedYes, that is true, but in the one I made, you can make exceptions. Say you are making an adventure map and want the player to find a wooden shovel or something before destroying sand blocks. He won't be able to destroy them with his hand or any other object, just the shovel. But yea, I guess if people don't want that they can use yours
Edit, yes now that I look at it this is overly complicated. Made this a while back.
Edit, I fixed it, thanks
yea, that would be super easy, good idea
Edit, I just decided to throw it in with this mod. Why not.
404 does not exist
Nice
I want use it to my map
function destroyBlock(x, y, z, s){ preventDefault(); } function useItem(x, y, z, i, b, s){ preventDefault(); }or even
function destroyBlock(x, y, z, s){preventDefault();} function useItem(x, y, z, i, b, s){preventDefault();}