-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MineKhan Modders Wiki ! (MMW) #30
Comments
How to Make new blocks, although it can take a bit of time. Here are instructions:
Not all blocks work. If you look at my code (which I recommend doing to see examples of what I did), you will see a couple of block textures commented out, like creeperHead. Those textures don't work and break the program because they have too many unique colors and the encoder I use has a limit of 36 colors. Usually if the program isn't working, it's because you made a mistake in spelling or formatting. made by 🍉 Sally the Great 🍉 |
You could also use this to make textures: https://www.khanacademy.org/computer-programming/minekhan-block-maker/6681656548605952/embedded?editor=no |
How To Add TNT Back:
|
I know this may be an older issue, but I may start working on a mod loader for this. That way we can make adding stuff easy to add. I probably will make a fork if this gets open sourced under some permissive license (This version, the KA Version already is MIT) |
I find it real annoying that people are adding unexplodable tnt, so here is the code.
Also, this in the hitbox.pos if
and
at the end of the code..... as we know it.... and I feel fine. |
All it does is that it replaces blocks with air, once it's clicked. |
And if there is anyone that doesn't understand this, just contact me. |
That code looks like my code. function sphereoidAt(X,Y,Z,w, h, d, id) {
let w2 = w * w
let h2 = h * h
let d2 = d * d
let w3 = (w - 1.5) * (w - 1.5)
let h3 = (h - 1.5) * (h - 1.5)
let d3 = (d - 1.5) * (d - 1.5)
for (let y = -h; y < h; y++) {
for (let x = -w; x <= w; x++) {
for (let z = -d; z <= d; z++) {
let n = x * x / w2 + y * y / h2 + z * z / d2
let n2 = x * x / w3 + y * y / h3 + z * z / d3
if (n < 1 && n2 >= 1) {
world.setBlock(X + x, Y + y, Z + z, id)
}
}
}
}
} |
@GuineaPigBridge
what do you mean by that? |
It's just the friggin place you put the code in. |
How to add new block shapes (beds, torches, plants, etc...)We will be using plant shape for this tutorial {
verts: [
[objectify(8, 0, 8, 1, 1, 0, 0)], //bottom
[objectify(8, 16, 8, 1, 1, 0, 0)], //top
[objectify(16, 16, 8, 16, 16, 0, 0)], //north
[objectify(0, 16, 8, 16, 16, 0, 0)], //south
[objectify(8, 16, 0, 16, 16, 0, 0)], //east
[objectify(8, 16, 16, 16, 16, 0, 0)] //west
],
cull: {
top: 0,
bottom: 0,
north: 0,
south: 0,
east: 0,
west: 0
},
texVerts: [],
varients: [],
buffer: null,
size: 6,
}, 2. Next, you add it to the shapes object let shapes = {
//other shapes
plant: {
verts: [
[objectify(8, 0, 8, 1, 1, 0, 0)], //bottom
[objectify(8, 16, 8, 1, 1, 0, 0)], //top
[objectify(16, 16, 8, 16, 16, 0, 0)], //north
[objectify(0, 16, 8, 16, 16, 0, 0)], //south
[objectify(8, 16, 0, 16, 16, 0, 0)], //east
[objectify(8, 16, 16, 16, 16, 0, 0)] //west
],
cull: {
top: 0,
bottom: 0,
north: 0,
south: 0,
east: 0,
west: 0
},
texVerts: [],
varients: [],
buffer: null,
size: 6,
},
} 3. Block constant const CUBE = 0
const SLAB = 0x100 // 9th bit
const STAIR = 0x200 // 10th bit
const PLANT = 0x300 4. Initializing the shape let baseBlock = blockData[i]
let slabBlock = Object.create(baseBlock)
let stairBlock = Object.create(baseBlock)
let plantBlock = Object.create(baseBlock) //add this
baseBlock.shape = shapes.cube
slabBlock.shape = shapes.slab
stairBlock.shape = shapes.stair
plantBlock.shape = shapes.plant //add this
blockData[i | SLAB] = slabBlock
blockData[i | STAIR] = stairBlock
blockData[i | PLANT] = plantBlock //add this 5. Add plant block shape option if (k === "enter") {
blockMode = blockMode === CUBE ? SLAB : (blockMode === SLAB ? STAIR : (blockMode === STAIR ? PLANT : CUBE))
updateHUD = true
} 6. Block icon data = []
for (let j = 11; j >= 0; j--) {
data.push(-hexagonVerts[j * 3 + 0] * scale)
data.push(hexagonVerts[j * 3 + 1] * scale)
data.push(0.1666666)
data.push(textureCoords[textureMap[block.textures[texOrder[floor(j / 4)]]]][(j * 2 + 0) % 8])
data.push(textureCoords[textureMap[block.textures[texOrder[floor(j / 4)]]]][(j * 2 + 1) % 8])
data.push(shadows[floor(j / 4)])
}
buffer = gl.createBuffer()
gl.bindBuffer(gl.ARRAY_BUFFER, buffer)
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.STATIC_DRAW)
blockIcons[i | PLANT] = buffer
blockIcons.lengths[i | PLANT] = 6 * 3 And now you have a new block shape! |
If you dont want to make your own block shapes, go here: https://khanacademy.org/profile/monsterred/projects |
This was already in the code at the bottom. I just presumed that you took out the // when you downloaded minekhan. |
The version that was already in the code used p2.x, p2.y, p2.z for the X, Y, Z since I was using it from the dev console while I played. It doesn't work in multiplayer unless you're the host (thanks to a bug, but it's for the best lol). Personally if I was going to add it as an actual mechanic, I'd use the more efficient |
i'm actually quite familiar with modding MineKhan, check out my latest mod it shows new block implementation, and includes several of my new block shapes, and also shows playing with lighting (although night/day cycle is messed up, so i turned it off) |
I mean, it looks amazing. Just the block icons are messed up a bit. But still. Pretty good. |
yeah i know the icons are messed up, it would be nice if the icons were presented by the actual block shapes, rather than making a whole new model for it that works on completely different rules. so for now i just do random shapes and try to remember what is what (i'm looking at adding auto shape change, so when you place a lantern, even if your on cube, it will place the correct shape). oh, and thank you for the compliments |
if you don't have minecraft, the easiest way to get the textures is to go here: |
How to make broken saves work againGo to Chunk.load (above "class Contacts") and you will see this:
Just change it to this:
And know if you load the broken save, it works! |
Use p2 instead of p if(p.scaffold){
if(!world.getBlock(p2.x,p2.y-2,p2.z)){
world.setBlock(p2.x,p2.y-2,p2.z, holding)
}
} |
tysm, that fixed it |
wait however, you now move super fast when sneaking, and scaffold is on |
nvm, I found the error |
haha missing texture go brrrrr |
There is also a wiki at: https://github.com/Willard21/MineKhan/wiki/Modding |
how do i add vegitation to minekhan and im using the old khan academy code in notepad to make my mods please help and i need working doors |
Plants have been added by many mods but doors are more complex as they require you to have "states" for the block and custom models. You can try, but it would probably be pretty complex. |
the good thing about that is that if you try and understand the object literals you can learn to make custom blocks yourself |
Here you can post step-by-step instructions on how to add new blocks to MineKhan or new items to MineKhan , how to work around the hundred of lines of code that MineKhan runs on.
Possible Questions:
1.How to add new blocks
2.How to mess round with the lighting / where.
3.How to style buttons in the code or which lines you should look around the edit.
And Plenty More!
The text was updated successfully, but these errors were encountered: