So I've been looking into implementation of custom blocks. Treebl and MrARM have already worked out how to create a custom block; however, we need to specify the properties of the blocks.
I'm asking for ideas on what the API would look like on the ModPE side
Stuff that it should be able to set:
* block ID
* brightness
* transparency
* hardness
* texture
- preferable if we can have different textures on each side and for each data value
Other requirements:
* easy to type, particularly on a mobile keyboard. A 100-parameter function may not be very friendly in this area.
* fits in with existing ModPE script methods
Any ideas on what this would look like?
Be creative.
Edit #2: should I start a new top-level package. i.e. BlockMaterial.add() instead of ModPE.setBlock()?
Add namespace:
Block
Methods within:
Block.createNew(int Id, int data, String name);
Block.setRenderType(int Id, int data, int renderType);
Block.setGuiBlocksTexture(int Id, int data, int x, int, y); //If omitted, will be set to render the block itself into the inventory, like when you remove gui_blocks.png
Block.setBrightnessLevel(int Id, int data, float lightLevel);
Block.setTransparent(bool isTransparent); //Technical transparency: Can we place torches on it? Open chests under it?
Block.setOpacity(int Id, int data, float opacity);
Block.setExplodeRes(int Id, int data, float resistence);
Block.setMaterial(int Id, int data, ??? material); //No idea what the data type would be. Depends if you implement each material type in a way we can call them as ints, who knows?
Block.setStepSound(int Id, int data, String sound);
Block.setBreakSound(int Id, int data, String sound);
Block.setTool(int Id, int data, int toolId, int toolData, int breakSpeed, int dropId, int dropData); //To make certain tools work better than others, use 0, 0 to make it drop nothing.
Block.setDefaultBreakSpeed(int Id, int data, float breakSpeed, int dropId, int dropData);
//This will be the break speed and dropability of all blocks by default, but the above method can make certain tools work differently.
Block.setWalkable(bool walkThrough); // Although, this may be a render type to make walk through blocks, not sure.
AND AS FOR TEXTURES:
Block.setTerrainTex(int Id, int data, int sideIds);
// Pass this in as a 2 dimensional array.
var sides = [
[0, 0], [2, 7], [3, 5], [4, 8], [1, 10], [4, 8]
]
// x side, x- side, z side, z- side, top, bottom
EXAMPLE CODE:
function addBlocks() {
//Podzol(from PC 1.7)
var podzolTex = [
[0, 3], [0, 3], [0, 3], [0, 3], [0, 2], [0, 2] // Grass sides, dirt on top and bottom
]
Block.createNew(3, 1, "Podzol");
Block.setRenderType(3, 1, 0); // Let's pretend 0 is a solid block
Block.setTerrainTex(3, 1, podzolTex);
Block.setMaterial(3, 1, 0); //Once again, pretend it's dirt's
//etc.
}
Rollback Post to RevisionRollBack
Back to modding! Follow me on Twitter @byteandahalf
Different render types have different texturesBtw 500 ise you can disable the java bridge but before that add the GUI.addLayout fxI am thinking about like Android define views like
var block=new Block(int id, int damage);
block.setTexture(String texture...);
...
Missed block.define();
But too complicated for some people.
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:
Btw 500 ise you can disable the java bridge but before that add the GUI.addLayout fx
I am thinking about like Android define views like
var block=new Block(int id, int damage);
block.setTexture(String texture...);
...
Missed block.define();
But too complicated for some people.
He said on Twitter he'll use mine, but not sure how much of mine. P.S. The texture method is very picky, that's why I used 2 dimensional arrays, it can add the textures, but only with one parameter, which would normally be like 9.
??? The render types and textures are in no way related. The render type is simply the shape of the block. No matter what, the texture will just be put ontop of the block, stretching to fit the render type. And the textures are from terrain.png, you need 2 arguments for each side, 6 sides = 12. This way I have can make that one parameter, simply with an outside array :)Here is the picture Zhuowei posted on Twitter of a block he added:Judging by me reading the code, this has a material of dirt.
Rollback Post to RevisionRollBack
Back to modding! Follow me on Twitter @byteandahalf
He said on Twitter he'll use mine, but not sure how much of mine. P.S. The texture method is very picky, that's why I used 2 dimensional arrays, it can add the textures, but only with one parameter, which would normally be like 9.
??? The render types and textures are in no way related. The render type is simply the shape of the block. No matter what, the texture will just be put ontop of the block, stretching to fit the render type. And the textures are from terrain.png, you need 2 arguments for each side, 6 sides = 12. This way I have can make that one parameter, simply with an outside array
Here is the picture Zhuowei posted on Twitter of a block he added:
Judging by me reading the code, this has a material of dirt.
Did Zhuowei show the code?
I actually saw the commit on GitHub 15 minutes after he commited it on GitHub.
He said on Twitter he'll use mine, but not sure how much of mine. P.S. The texture method is very picky, that's why I used 2 dimensional arrays, it can add the textures, but only with one parameter, which would normally be like 9.
??? The render types and textures are in no way related. The render type is simply the shape of the block. No matter what, the texture will just be put ontop of the block, stretching to fit the render type. And the textures are from terrain.png, you need 2 arguments for each side, 6 sides = 12. This way I have can make that one parameter, simply with an outside array
Here is the picture Zhuowei posted on Twitter of a block he added
Judging by me reading the code, this has a material of dirt.
I'll leave this thread up all weekend for comments/ideas, then I'll decide at the end.
var customblock = new Block(id, data, name);
customblock.setTexFront(x, y); //...etc
customblock.setDefaultTex(x, y); //Can be used to run aside setTexFront...etc
customblock.setEmitance(emitance); //Brightness
customblock.setRenderType(rendertype); //Sets the rendertype (render as fence or snow...etc)
customblock.setSound(stepsound, breaksound); //Sound?
customblock.setDurability(durabilty); //Ticks it takes to break
Since custom blocks are not ready yet, I'm not releasing an official beta. It's a 1GB download since you need the Android NDK as well as the Android 4.2 and 2.3 SDKs.
There is water, but that's rendered on a separate layer, so rendering blocks with it causes many many glitches.
Then can we add a block as liquid, everything like water except water dynamic and flowing distance?
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:
ModPE.setBlock(blockId, terrain.png X, terrain.png Y, block strength, blockBrightness,"//Name Here");
It would be easier to use.
Rollback Post to RevisionRollBack
Make sure you follow me on twitter! @DarkDiaMiner IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI'm asking for ideas on what the API would look like on the ModPE side
Stuff that it should be able to set:
* block ID
* brightness
* transparency
* hardness
* texture
- preferable if we can have different textures on each side and for each data value
Other requirements:
* easy to type, particularly on a mobile keyboard. A 100-parameter function may not be very friendly in this area.
* fits in with existing ModPE script methods
Any ideas on what this would look like?
Be creative.
Edit #2: should I start a new top-level package. i.e. BlockMaterial.add() instead of ModPE.setBlock()?
Back to modding! Follow me on Twitter @byteandahalf
Back to modding! Follow me on Twitter @byteandahalf
Missed block.define();
But too complicated for some people.
He said on Twitter he'll use mine, but not sure how much of mine. P.S. The texture method is very picky, that's why I used 2 dimensional arrays, it can add the textures, but only with one parameter, which would normally be like 9.
??? The render types and textures are in no way related. The render type is simply the shape of the block. No matter what, the texture will just be put ontop of the block, stretching to fit the render type. And the textures are from terrain.png, you need 2 arguments for each side, 6 sides = 12. This way I have can make that one parameter, simply with an outside array :)Here is the picture Zhuowei posted on Twitter of a block he added:
Back to modding! Follow me on Twitter @byteandahalf
Did Zhuowei show the code?
I actually saw the commit on GitHub 15 minutes after he commited it on GitHub.
"one does not simply hook Creeper::getMaxHealth"
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIt's there (with my own fail attempt at an API).
I'll leave this thread up all weekend for comments/ideas, then I'll decide at the end.
I meant the ModPE Script code.
I want to get this working
"one does not simply hook Creeper::getMaxHealth"
All weekend? You mean we won't get this until the week? Darn man, that's harsh...
Back to modding! Follow me on Twitter @byteandahalf
you can build from the source.
"one does not simply hook Creeper::getMaxHealth"
Back to modding! Follow me on Twitter @byteandahalf
You will have to ask MrARM on how to do that. I do succeed at it, however.
"one does not simply hook Creeper::getMaxHealth"
1 GB? What do you mean we'll need to download something?
I made it terrain.png because you could use the pink/empty spaces.
+1 Me If I Helped You!
Follow Me On Twitter: @shadowdude246
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSince custom blocks are not ready yet, I'm not releasing an official beta. It's a 1GB download since you need the Android NDK as well as the Android 4.2 and 2.3 SDKs.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThere is water, but that's rendered on a separate layer, so rendering blocks with it causes many many glitches.
Then can we add a block as liquid, everything like water except water dynamic and flowing distance?
It would be easier to use.
IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->