Im making a new ModPE, but im not sure of how to design the API. This gist contains diffrrnet examples of how i can implement stuff.
Feel free to comment.
(https://twitter.com/TheDiamondYT) (https://instagram.com/bruhitzzluke)
Im making a new ModPE, but im not sure of how to design the API. This gist contains diffrrnet examples of how i can implement stuff.
Feel free to comment.
(https://twitter.com/TheDiamondYT) (https://instagram.com/bruhitzzluke)
[{ | |
"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(); |
@CrazyWolfy123 Added.
I think that your idea is cool!
@Khristan-kun Thanks! Any suggestions?
I think that you should make the modpe code being able to put inside of any addon (on jni code)
Line 44: You should add another parameter to call a void when the command is executed.