Skip to content

Instantly share code, notes, and snippets.

@TheDiamondYT1
Last active February 2, 2017 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheDiamondYT1/0fd242712652cecbf7cf5937cb2077e7 to your computer and use it in GitHub Desktop.
Save TheDiamondYT1/0fd242712652cecbf7cf5937cb2077e7 to your computer and use it in GitHub Desktop.
A new version of ModPE. This is just for ideas on how the API should be. Please comment opinions.
[{
"id": "sexmod",
"name": "Sex Mod",
"description": "It's just a prank bro.",
"version": "1.0.1",
"mcversion": "1.0.0",
"supportUrl": "https://github.com/YoMama/SexMod/issues",
"depends": ["desnodildos", "pornhubingame", "notchrage"]
}]
/*** #ModPE ***/ // How all mods should start (Or some kind of hashtag, because hastags are lit af)
//********** Please comment on this gist with any suggestions or changes **********
// Core apis
var block = require('block');
var modpe = require('core');
var level = require('level');
var command = require('command');
var mod = require('mod')
var gui = require('gui');
/************ Other mods ************/
var desnodildos;
if(mod.find('desnodildos')) {
desnodildos = require('desnodildos');
} else {
mod.disable(this); // Or you could continue without disabling
}
desodildos.shootSomeCumAtDonaldTrump(); // A function within another mod
/************ Blocks ************/
/***** I prefer *****/
block.register({ // Or block.define?? I prefer register
name: 'Something', // Required
texture: 'grass', // Required
id: block.id.grass // Required (block.id.grass is an integer)
});
/********** Commands **********/
/***** (I like this method) *****/
command.register({
cmd: 'freediamonds', // Required
usage: '/freediamonds <player>', // Required
permission: command.permission.all, // Not required (Defaults to: all) (command.permission.all is a string)
onexecute: doSomething() // Required (doSomething() is a function)
});
/********** Events **********/
/***** Decent method *****/
modpe.onEvent('levelLoaded', function() {
// Some examples of sh1t
modpe.log("Hey there dude level has been loaded"); // You know what this does
});
modpe.onEvent('playerChat', function(text) {
// More examples of sh1t
var player = level.player("YoMama");
level.chat(player, "&bLol &cm8" + text); // Auto replace & to § :) (player arg)?
sendChat(player, "This is also a method that could be used??"); // Maybe this aswell??
});
/***** Also a good method , probably the best *****/
var events = require('events');
events.on(events.type.levelLoaded, function() { // events.type.levelLoaded is a string
level.chat("Hey bae");
});
/************ GUI ************/
/***** Decent method *****/
var button = gui.register(gui.type.button, { // gui.type.button is a string
text: 'Bruuuuhhh', // Not required (Defaults to: no text)
position: gui.position.left, // Required (gui.position.left is a string)
style: gui.style.minecraft, // Not required (Defaults to: device default) (gui.style.minecraft is a string)
onclick: doSomething() // Required (doSomething() is a function)
}).show();
button.setText("Bruuuuuuuuuuhhhhh"); // Change button text after its created
button.setPosition(gui.position.right); // gui.position.right is a string
/// OR MAYBE (I prefer to the one above) ///
button.text("ksjsjw");
button.position(gui.position.right);
//*** Fecking dialogs ***//
var dialog = gui.register(gui.type.dialog, { // gui.type.dialog is a string
title: 'Bruuuuhhh', // Not required (Defaults to: no title)
text: 'Do you want to leave the pornhub app?', // Not required (Defaults to: no text)
positiveButton: // Not required (Defaults to: no positive button)
text: 'Yes', // Required
onclick: doSomething(), // Required (doSomething() is a function)
negativeButton: // Not required (Defaults to: no negative button)
text: 'Me want porn', // Required
onclick: dialog.dismiss() // Required (dialog.dismiss() is a function in the gui class)
}).show();
@bia5
Copy link

bia5 commented Jan 27, 2017

Line 44: You should add another parameter to call a void when the command is executed.

@TheDiamondYT1
Copy link
Author

@CrazyWolfy123 Added.

@Khristian-kun
Copy link

I think that your idea is cool!

@TheDiamondYT1
Copy link
Author

@Khristan-kun Thanks! Any suggestions?

@Khristian-kun
Copy link

I think that you should make the modpe code being able to put inside of any addon (on jni code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment