#How can I make a new block?

1 messages · Page 1 of 1 (latest)

worldly gust
#

There are guides to help you through the process of coding a block in Microsoft Docs and the Bedrock Wiki

#

If the geometry is smaller or equal to 30x30x30 pixels, yes

#

Otherwise no

#

Happy to help

tidal geode
#

Since you don’t have much experience I’d make an entity

latent crystal
#

Hi Dark, I am a newbie myself, but I´ve come to know how to do this:
All you have to do is

  • choose if you want a block or entity (you can use either)
  • if you want to make your beautiful model a block (which is more work but better imo), then (which by the looks of your model) it seems to be over the limit, do this: Make sure your model height is not over 30 pixels. If it is higher just lower it and adapt the texture accordingly.
    Next, you will have to split your model in 2 halves. (left half and right half)
  • Wardrobe_L and Wardrobe_R (let´s pretend each model is 16 pixels wide and 30 pixels tall...
    So after you create both versions, when you place them in the world, just place them side by side and it will make a full wardrobe!
    If you need all the steps, just let me know and I will send them to you tomorrow.
    Lastly if you make it an entity then you have no problems. Just make it and it will work.
    The only bad thing is rotation.... and this part I do not know the answer to because like I said, I am a newbie and I do not code. So because of this, if I place an entity down as a furniture, it will always rotate in several angles instead of pure perfect 90 degrees (which is not what we want).
    The advantage of blocks is this problem does not happen as they only have 4 perfect 90 degrees facing.
    if anyone knows how we can place entities like blocks facing only 4 directions (facing the player, like we can with blocks) let me know and I will stand up and applaud you Sir! 😄
#

Well to close it up if you really want your model as a block but want to still keep its height above the limit, then you will need to split your model in 4 parts instead of 2 (left_bottom, left_top, top_right, bottom-right

tidal geode
#

You can use the cardinal_direction trait. I’m on my phone so I really don’t have the ability to show you how it works

#

But the wiki does exist for a reason you know

#

I’ll grab the specific wiki article you’d need

latent crystal
#

yeah but answers are like where? only people who knows like you can guide us in the right direction

#

thank you! i´ll come back and check too! 🙂

tidal geode
#

This has all you need under “cardinal direction”

latent crystal
#

wait but this is for an entity right?

tidal geode
#

Nope

#

Block

latent crystal
#

ayyyyyy block I already know 😄

tidal geode
#

Entity is just a quicker way to get a large model placed down. If you wanted to make the block better you could go down the rabbit hole of scripting and custom components to a make a block that would place both halves in the proper direction and what not

latent crystal
#

yeah great idea, blocks are much more performance friendly huh

tidal geode
#

Yeah

tidal geode
#

If you think about it, it’s basically a bed lmao

latent crystal
#

problem is we can´t animate a block like rotate a ceiling fan.. or if we make a fridge block we can´t make it door open correct?

tidal geode
#

It needs scripting though

latent crystal
# tidal geode It needs scripting though

oops see since scripting is like telling me read a book.. the best is to point us towards the specifics we will need to learn to do Just that... because or else we will spend months having to learn so much undeeded stuff til we can go and make what we really want...
That´s why templates are a great go...

#

gosh it´s 1:20am i gott go to sleep 😄 I will read your last comment and go, lol (I´m just saying this to my self though)

tidal geode
#

For the ceiling fan you need to (not great explanation sorry)

  1. Make models for each rotation
  2. Make a state in your block(number ex. 1-12)
  3. Make permutations that checks that state
  4. In each permutation set the geometry to rotation geometry
  5. Make a custom block component that has onTick, then increment the state(I can show you an example in a few days when I’m at my pc)
#

It’s a bit complicated

latent crystal
#

ah so it involves multiple rotated blocks models huh

tidal geode
#

For a fridge it’s less complicated since you only need 2 models that are switched when interacted with

tidal geode
#

The permutation is just a “variant” in that one block. The state is a value of that block that determines which variant is used. Each variant has a different 3D model.

latent crystal
#

right

tidal geode
#

The rotated blocks example has a different block rotation in each variant instead of a different 3D model

latent crystal
#

interesting! alright off to bed I go I will check in coming days for your template! but this was great to know though anyhoos!

tidal geode
#

See ya

latent crystal
#

will do soon (just woke up)

#

by the way where can I begin with? because like up to where do you know how to do? or which part would you like me to begin with?

#

ok let´s chat on to it

#

in blockbench what is the size of your model? height and width in pixels

#

because you know you need to keep the model in the same pixel size as the texture 😉 to be faithful to default MC looks

#

if you´d like, you can send me he model and I can look at it and figure out how to resize it for you appropriately

#

oh ok, no problem! later let me know when you can come back so we can be together so i can show you

#

Let meknow if it is ok for your model to be like this, because all I had to do is bring it down 2 pixels in height and now you can use it with just ONE full block model! no need to split it.
Because now it is not exceeding the 30x30x30 limit asfaik

#

Here it is! now you do not have to split the model in 2. You can use it like this as a full block asfaik! I have a modern wardrobe too that I made for my free addon 🙂 - I called it the same name but in Brazilian portuguese

latent crystal
#

whenever you make another model that will have to be bigger than the allowed block limit, but still need to be a block, let me know and I will teach you how to split the model correctly!

fierce plume
#

That's what I did with my ceiling fan

tidal geode
#

im just saying how i would do it ¯_(ツ)_/¯

#

if you do a 2d fan that works

fierce plume
#

Would also work for 3d if you know what you're doing

#

It's just less strain to handle block animations as flipbook and not permutations

wise dragon
latent crystal
wise dragon
latent crystal
#

misaligned

#
    "format_version": "1.8.0",
    "minecraft:entity": {
        "description": {
            "identifier": "vvelha:estante",
            "is_spawnable": true,
            "is_summonable": true,
            "is_experimental": false
        },
        "components": {
            "minecraft:type_family": {
                "family": [
                    "furniture"
                ]
            },
            "minecraft:scale": {
                "value": 1.0
            },
            "minecraft:collision_box": {
                "width": 1,
                "height": 1
            },
            "minecraft:physics": {},
            "minecraft:pushable": {
                "is_pushable": false
            },
            "minecraft:health": {
                "value": 1,
                "max": 1
            },
            "minecraft:knockback_resistance": {
                "value": 999,
                "max": 999
            }
        },
        "events": {
            "facing_south": {
                "run_command": {
                    "command": [
                        "tp @s ~ ~ ~ facing ~ ~ ~-1"
                    ]
                }
            },
            "facing_west": {
                "run_command": {
                    "command": [
                        "tp @s ~ ~ ~ facing ~1 ~ ~"
                    ]
                }
            },
            "facing_east": {
                "run_command": {
                    "command": [
                        "tp @s ~ ~ ~ facing ~-1 ~ ~"
                    ]
                }
            }
        }
    }
}```
wise dragon
#
            "loop": true,
            "animation_length": 3,
            "bones": {
                "head": {
                    "rotation": {
                        "0.0": [2.5, 0, 0],
                        "1.5": [0, 0, 0],
                        "3.0": [2.5, 0, 0]
                    }
                },
                "hat": {
                    "rotation": {
                        "0.0": [0, 0, 0],
                        "0.5": [0, 0, 0],
                        "1.0": [0, 0, 0]
                    }
                },
                "leftArm": {
                    "rotation": {
                        "0.0": [0, 0, 0],
                        "1.5": [0.09776, -0.47873, -2.4522],
                        "3.0": [0, 0, 0]
                    }
                },
                "rightArm": {
                    "rotation": {
                        "0.0": [0, 0, 0],
                        "1.5": [0, 0, 2.5],
                        "3.0": [0, 0, 0]
                    }
                },
                "bod": {
                    "scale": {
                        "0.0": [1, 1, 1],
                        "1.5": [1, 1, 1.1],
                        "3.0": [1, 1, 1]
                    }
                },
                "all": {
                        "rotation": [
                        0,
                        "-q.body_y_rotation+(math.round(q.body_y_rotation/90)*90)",
                        0
                    ]
                }
            }
        },
latent crystal
#

well I have made an animation for the 4 directions and have created thus an animation controller, edited the behavior json and made the animation file

wise dragon
#

Pay attention to this specific line:

#
                        0,
                        "-q.body_y_rotation+(math.round(q.body_y_rotation/90)*90)",
                        0
                    ]
#

It's what makes rotation work.

latent crystal
#

ok I will see to implement that... will let you know if worked

#

but wait sorry this goes into animation file or animation controller file in the BP folder?

wise dragon
#

You must implement that animation as a base, so that when the entity spawns, that animation is immediately executed and it rotates

#

As I said, it has to be in the animation that runs first when spawning the entity, it goes in the animation file, not in the controller.

latent crystal
#

perfect ok

#

this is how it is set in Blockbench

#

and the animatin file: ```{
"format_version": "1.8.0",
"animations": {
"animation.estante.idle": {
"loop": false,
"bones": {
"Estante": {
"rotation": [0, 0, 0]
},
"all": {
"rotation": [
0,
"-q.body_y_rotation + (math.round(q.body_y_rotation / 90) * 90)",
0
]
}
}
}
}
}

wise dragon
#

Change the "all" to the name of a folder of your model, you must put your complete model inside a folder, that is to say... in blockbench create a folder in your model and put all your bones and folders in that new folder, I recommend calling it "all" so you avoid changing the name in the code I just gave you.

#

Look at this

#

I have everything that is the model, inside the "all" folder

#

And the animation makes everything inside the "all" folder rotate based on where the player is looking.

latent crystal
#

ahuh I changed the root folder to all

wise dragon
#

This is how it can work.

#

Try to see if it works.

latent crystal
#

ok let me go back and readjust

wise dragon
#

It should look something like this:

latent crystal
#

It threw this error, but I guess we are almost there! 😄
[Animation][error]-C:/Users/Micro/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_resource_packs/Vila_Velha-RP/animations/estante.animation.json | animations | animation.estante.idle | all | child 'all' not valid here.
Below is the animation file

#
    "format_version": "1.8.0",
    "animations": {
        "animation.estante.idle": {
            "loop": false,
            
                "all": {
                    "rotation": [
                        0,
                        "-q.body_y_rotation + (math.round(q.body_y_rotation / 90) * 90)",
                        0
                    ]
                }
            }
        }
    }
}
wise dragon
#

Use this:

#

{
"format_version": "1.8.0",
"animations": {
"animation.estante.idle": {
"loop": false,
"bones": {
"all": {
"rotation": [
0,
"-q.body_y_rotation + (math.round(q.body_y_rotation / 90) * 90)",
0
]
}
}
}
}
}

#

Hahaha it should work now.

latent crystal
#

didn´t work 😦

#

maybe it´s my entity json behavior hold on

#

here is the behavior -is it still ok?: { "format_version": "1.8.0", "minecraft:entity": { "description": { "identifier": "vvelha:estante", "is_spawnable": true, "is_summonable": true, "is_experimental": false }, "components": { "minecraft:type_family": { "family": [ "furniture" ] }, "minecraft:scale": { "value": 1.0 }, "minecraft:collision_box": { "width": 1, "height": 1 }, "minecraft:physics": {}, "minecraft:pushable": { "is_pushable": false }, "minecraft:health": { "value": 1, "max": 1 }, "minecraft:knockback_resistance": { "value": 999, "max": 999 } }, "events": { "facing_south": { "run_command": { "command": [ "tp @s ~ ~ ~ facing ~ ~ ~-1" ] } }, "facing_west": { "run_command": { "command": [ "tp @s ~ ~ ~ facing ~1 ~ ~" ] } }, "facing_east": { "run_command": { "command": [ "tp @s ~ ~ ~ facing ~-1 ~ ~" ] } } } } }

#

Once this is fixed this will make ao so happy, no errors this time though

wise dragon
#

That doesn't seem to have anything wrong

#

Show me the file. Your entity.

#

From ResourcePack

latent crystal
#

Ok

#
    "format_version": "1.10.0",
    "minecraft:client_entity": {
        "description": {
            "identifier": "vvelha:estante",
            "materials": {
                "default": "entity_alphatest"
            },
            "textures": {
                "default": "textures/entity/estante"
            },
            "geometry": {
                "default": "geometry.estante"
            },
            "render_controllers": [
                "controller.render.furniture"
            ],
            "spawn_egg": {
                "base_color": "#FFFFFF",
                "overlay_color": "#C0C0C0"
            }
        }
    }
}
wise dragon
#

There is the error.

#

You didn't add any animation to that entity.

latent crystal
#

so please can you send me the added info? I don´t know how to write that in 😭

wise dragon
#
    "format_version": "1.10.0",
    "minecraft:client_entity": {
        "description": {
            "identifier": "vvelha:estante",
            "materials": {
                "default": "entity_alphatest"
            },
            "textures": {
                "default": "textures/entity/estante"
            },
            "geometry": {
                "default": "geometry.estante"
            },
            "render_controllers": [
                "controller.render.furniture"
            ],
            "spawn_egg": {
                "base_color": "#FFFFFF",
                "overlay_color": "#C0C0C0"
            },
              "animations": {
                "rot": "animation.estante.idle"
            },
    "scripts": {
                "animate": [
                    "rot"
                ]
            }
        }
    }
}
#

Usa ese

#

use that

latent crystal
#

will checkj

#

still does not work

wise dragon
#

Are you recharging the world?

latent crystal
#

yes I restart the world

wise dragon
#

Try the addon in a new world.

latent crystal
#

ok

#

i will send you the 3 files so you see all is correct

#

behavior animation and entity

wise dragon
#

Okey

latent crystal
wise dragon
#

You don't speak Spanish?

latent crystal
#

Yes I speak 3 languages

wise dragon
#

I use the translator because I only speak Spanish hahaha

#

I send you the files again with the small correction I made to them.

latent crystal
#

Wow puedes hablar conmigo em Espanol in dm

wise dragon
#

Okay okay, let's talk Dm because we already filled this space Haha

latent crystal
#

Hey, I am back to do some things! first to thank @wise dragon for the kindness, patience and good heart to help me. Second, to say I payed a friend of mine who I knows well and that understands a lot and he made the json files for me and after some talk over how to implement it to other entities, all my entities are facing me (the player) and they even animate when placed which is cute. So I am very happy with this because I have several big furniture and models such as barraks and park stuff that need this functionality.
So Second, I am sharing here with you all who may need it! you only need a behavior json and an animation controller json. Here they are (examples) enjoy 🙂 - oh btw, they are for 1.20.81 - I do not know if these work on 1.21