#Technical blocks

1 messages ยท Page 3 of 1

woven nest
#

Rather than special casing any specific ones

dire blade
#

yeah use tooltips

#

using even more models would just be super annoying

#

also condensed creative would be great for this

#

and it goes back to 1.18.2

woven nest
#

Remember the item name is a component

#

You can totally just append the state to it

charred pasture
#

alright

#

and then it shouldn't affect the actual item id

#

only used for rendering the model

woven nest
#

You probably want to store the actual state in a component as well

#

String parsing is expensive, and doing it every frame is moreso

charred pasture
#

for mc blocks

#

they don't store blockstate components

#

they generate the blockstate each time you place

#

based on the current context

dire blade
#

so like

#

water[minecraft:block_state={"level":"5"}] works

#

might have screwed up the quotes but you get the idea

charred pasture
#

really

#

there are block state components

dire blade
#

yeah

#

but no tooltip

#

so I think just go through all blocks and their blockstates and give them tooltips

#

using components

charred pasture
dire blade
#

yeah

#

also with blockstates added hopefully everything no longer faces north

charred pasture
#

it's fine if you can't

#

i'll try to figure it out later on pc

dire blade
#

I think

#

like there is probably a label component

#
Minecraft Wiki

Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.
Data components are used in various places, including the player's inventory, container block enti...

#

yeah

charred pasture
#

trial and error once on pc

#

see what works

dire blade
#
Minecraft Wiki

Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.
Data components are used in various places, including the player's inventory, container block enti...

#

oh here it is

#

lore

#

also for blockstates remember

#

exclude directional stuff as that'll probably add a ton of unnecessary items

#

so a piston head would have like 20 instead of 4

woven nest
#

You'd probably sooner register an appender than use lore

#

Lore is mostly for datapackers

dire blade
#

yeah

dire blade
#

oh with biomesoplenty

#

it registers blood and liquid null

#

so unmodded you could have them

charred pasture
#

huh

dire blade
#

yeah

charred pasture
#

what's it

dire blade
charred pasture
#

okay

#

wdym unmodded

#

you can have liquid blood

#

and liquid null

dire blade
#

yeah

#

without illicitblocks

#

(I keep on calling it illicititems)

charred pasture
#

erm

#

tr

#

fr

dire blade
#

yeah

charred pasture
#

by unmodded you mean

#

vanilla minecraft

dire blade
#

without illicitblocks

#

just bad wording

charred pasture
#

okay

#

so theres blood and liquid null

#

items

dire blade
#

I couldn't find them in the creative inventory but they were accessible with /give

charred pasture
#

with /gove

dire blade
charred pasture
#

give

charred pasture
#

it was

dire blade
charred pasture
#

since they already had

#

items

dire blade
#

yeah

#

I had forgotten about them already being registered

#

also for some reason the models are hardcoded to be nothing

charred pasture
#

it's nothing

#

it's invisible?

dire blade
#

in inventory yeah

charred pasture
#

well

#

it's probably something internal

#

don't think

#

like

#

i think you were supposed to use the bucket

#

to place

#

the fluids instead

dire blade
#

yeah

dire blade
#

because lava and water in illicitblocks are like that if you use the script

#

but they can get a model

#

if you define one through another pack or replace it

charred pasture
#

yes

#

probably cause

#

the python script

#

generates

#

with a block model

#

template_json = """
{{
"model": {{
"type": "minecraft:model",
"model": "{}:block/{}"
}}
}}
"""

charred pasture
#

@dire blade do you have your resource pack

#

of the thing you manually did for the models

#

i want to see it

charred pasture
#

by the way ive updated it to use the new item model loading thing

#

should be the same like using the python script but done dynamically this time

#

still have to work out some flaws

#

was hoping i could maybe use some kind of jsonunbakedmodel but thats fine

#

using existing models

woven nest
#

I mean

#

you can

#

just not yet

#

still working out how that works

charred pasture
#

would be very nice additions

#

to fapi

woven nest
#

we'll see. I'm waiting for pepper to look at the first thing before I actually make a pr

charred pasture
#

sure

dire blade
#

look around

#

you'll probably see the pattern

#

like liquids = flat item model with texture (texture is name_still)

#

crops = block model (points to block name_stage0)

#

plants = flat item model (block name is item texture)

#

there are some exceptions so look through stuff

#

there is one crop I put stage5 on by accident

dire blade
#

with me making these models

#

I like making the experience easier for myself in distinguishing items

#

but it's also about kinda laying the groundwork for everything

charred pasture
#

yes

#

also im really inexperienced with

#

internal minecraft rendering mechanics

#

ive been fooling around this entire time

#

and i somehow got this to work

#
            String modelJson = """
{
  "parent": "block/block",
  "textures": {
    "particle": "block/piston_top",
    "top": "block/piston_top",
    "side": "block/piston_side"
  },
  "elements": [
    {
      "from": [0, 0, 0],
      "to": [16, 16, 16],
      "faces": {
        "up":    { "texture": "#top" },
        "down":  { "texture": "#top" },
        "north": { "texture": "#side" },
        "south": { "texture": "#side" },
        "west":  { "texture": "#side" },
        "east":  { "texture": "#side" }
      }
    }
  ]
}
""";

            context.addAsset(Identifier.ofVanilla("piston_head"), new ItemAsset(
                    new JsonItemModelAdapter(
                            JsonUnbakedModel.deserialize(new StringReader(modelJson)),
                            List.of()
                    ),
                    ItemAsset.Properties.DEFAULT
            ));
#

so ugly

#

and prototype everywhere

#

i wanted to use

#
            String modelJson = """
            {
                "model": {
                    "type": "minecraft:model",
                    "model": "minecraft:block/piston_head"
                }
            }
            """;
#

but it didnt work

#

the modelJson above worked tho

#

terrible code

dire blade
#

yay

charred pasture
#

i'll wait for a better implementation

dire blade
#

yeah

charred pasture
#

from thewhyevenhow

#

if he ever makes one (no pressure)

dire blade
#

to make it generate different stuff for different tags

charred pasture
#

right now

charred pasture
#

your idea

dire blade
#

yeah

charred pasture
#

instead of this random rabbit hole

#

i've gotten to

dire blade
#

yeah

dire blade
charred pasture
#

(i have no idea what's going on or how it worked)

dire blade
charred pasture
#

okay

dire blade
#

it should be pretty simple

#

and cover most stuff

#

we already have models for the other stuff so that's nice

charred pasture
#

hopefully most of the missing models

#

will be gone

dire blade
#

yeah

charred pasture
#

automatically

dire blade
#

yeah

#

if my model scheme is implemented

#

there are a few exceptions and you'll stumble across them

#

the torchflower is super annoying

#

instead of stage0 it uses stage_0

charred pasture
#

erm

#

special exception for torch flower ig

#

i fixed the big size thing and i think it looks more normal

#

            @Override
            public @Nullable BakedSimpleModel getParent() {
                IllicitBlocks.LOG.info("The parent of the json is {}", jsonUnbakedModel.parent());
                IllicitBlocks.LOG.info("The parent model is {}", baker.getModel(jsonUnbakedModel.parent()));
                return baker.getModel(jsonUnbakedModel.parent());
            }
dire blade
#

what block is that

#

piston head?

charred pasture
#

random block i made

dire blade
#

hmm

charred pasture
#

i made it cleaner

#

more similar to how BasicItemModel does it

#

which is

#
        @Override
        public ItemModel bake(ItemModel.BakeContext context) {
            Baker baker = context.blockModelBaker();
            BakedSimpleModel bakedSimpleModel = baker.getModel(this.model);
            ModelTextures modelTextures = bakedSimpleModel.getTextures();
            List<BakedQuad> list = bakedSimpleModel.bakeGeometry(modelTextures, baker, ModelRotation.X0_Y0).getAllQuads();
            ModelSettings modelSettings = ModelSettings.resolveSettings(baker, bakedSimpleModel, modelTextures);
            return new BasicItemModel(this.tints, list, modelSettings);
        }
#

fun to mess around with

#
            String modelJson = """
{
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "minecraft:item/apple"
  }
}
""";
#

gonna test some of the

#

model jsons from your resource pack using this method

#
{
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "minecraft:block/water_still"
  }
}
#

erm water is white

#

yeah the textures are

#

theres the mcmeta

#

for it

#

is this true for your resource pack

#

probably tints are applied in world

#

and not for items

dire blade
#

but for water I could not find tint info

charred pasture
#

wait so

dire blade
#

other items like foliage can have it though

charred pasture
#

your water is white too?

dire blade
#

yeah

charred pasture
#

okay good

#

ntohings wrong yet with my adapter

dire blade
#

oh speaking of my pack

#

r3 includes wall banners

#

wall banners have a special template

charred pasture
#

okay

dire blade
#

but it relies on custom images being in minecraft/blocks

#

wall banners will have to likely be hardcoded

charred pasture
#

okay

dire blade
#

yeah

#

so just put in the root of the source

#

wait

#

give me a moment

#

the banner color pointers in /items

charred pasture
#

huh

dire blade
#

/src/main/resources/assets/minecraft/items

#

that's where the banner (everything _wall_banner) item pointers would go

#

/src/main/resources/assets/minecraft/models/item

#

for models (everything _wall_banner and wall_banner.json)

#

/src/main/resources/assets/minecraft/textures/block

#

for block textures

#

that's how you hardcode models

charred pasture
#

do you think

#

we should just apply your

#

resource pack

#

and then whatever models are missing

#

dynamically generate them

dire blade
#

I want everything to work

charred pasture
#

dynamically generate before hardcoding stuff

#

you mean like

dire blade
#

yeah

charred pasture
#

you want to see if it works first

dire blade
#

exactly

charred pasture
#

the dynamic generation

#

before the hardcoded resource pack

dire blade
#

yeah

#

hardcoded is like

#

last resort stuff

#

hardcoded and thus missing block models

#

missing textures

#

stuff like that

charred pasture
#

hardcoded guaranteed to work

#

but yes

dire blade
#

but that's kinda lazy and we need it to work with mods

charred pasture
#

i hardcoded water tint color

#

ColorHelper.getArgb(63, 118, 228)

dire blade
#

YES

#

I was just starting to mess with the weird integer colors in items

#

it was already driving me insane

charred pasture
#

lol

dire blade
#

ok

#

so I figured it out

woven nest
dire blade
#

so these weird values are ARGB to int

charred pasture
dire blade
charred pasture
#

packs colors

dire blade
#

yeah

charred pasture
#

into integers

dire blade
#

it's weird

charred pasture
#

you gotta do some math

dire blade
#

potions are like that too

woven nest
#

it's not bad if you work in hex though

charred pasture
#

if you want to turn a rgb color into that int so thats why

#

theres a ColorHelper

#

thingy

dire blade
#

yep

dire blade
#

the pain of trying to find the right color

#

completely guessing

charred pasture
#

or did you do some refactors

#

ah

#

i see it now

woven nest
#

I added a model adding callback
-# and unrelated qol brainstorming for the pr

charred pasture
#
AdditionalModelRegistrationCallback.EVENT.register(context -> context.addModel(Identifier.ofVanilla("that_one_thing"), new JsonUnbakedModel(null, null, null, null, new ModelTextures.Textures.Builder().addSprite("layer0", new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.ofVanilla("item/arrow"))).build(), Identifier.ofVanilla("item/generated"))));
    }
#

kinda crazy

#

its like model json but in code version

#

without having to use the

#

JsonUnbakedModel

woven nest
#

I mean

#

it is a JsonUnbakedModel

#

but I get the point

#

technically it takes any UnbakedModel

#

so you could implement it yourself as well

charred pasture
#

i implemented using jsonunbakedmodel

#

oh i see

#

your actually using a

#

json unbaked model

#

without using the

#

deserialize

woven nest
#

yeah

charred pasture
#

didnt see that

woven nest
#

deserializer is preferred, but in situations like this, it's more convenient to just register the model

charred pasture
#

yeah i think so too

#

you get auto completion in intellij and less need to verify the json works

dire blade
#

hmm

charred pasture
#

alright im gonna try

#

implementing the models now

dire blade
#

hopefully it works even though I have completely forgotten everything

charred pasture
#

Erm

#

forgot about

dire blade
#

OH

#

flat models

#

why am I so stupid like this sometimes

woven nest
charred pasture
#

okay

#

i suppose i can just use a deserializer

#

instead of having to do the

#

building it piece by piece

woven nest
#

do whatever works

charred pasture
#

yes

#

kind of looking ugly

#
            IllicitBlocks.blocksToHandle.forEach(id -> {
                Block block = Registries.BLOCK.get(id);
                String baseModelJson = """
                        {"parent": "%s", "textures": { "layer0": "%s:%s/%s" }}
                        """;
                String parent = "minecraft:item/generated";
                String namespace = "minecraft";
                String type = "block";
                String path = "dirt"
                List<TintSource> tints = List.of();



                baseModelJson = baseModelJson.formatted(parent, namespace, type, path);


                context.addAsset(id, new ItemAsset(
                        new JsonItemModelAdapter(
                                id,
                                JsonUnbakedModel.deserialize(
                                        new StringReader(
                                                baseModelJson
                                        )),
                                tints
                        ),
                        ItemAsset.Properties.DEFAULT
                ));
            });
#

this is probably

#

not the best way to do it

dire blade
#

but it might work I guess so that's all that matters

charred pasture
#

string parsing

#

maybe a string json helper

#

just a tiny implementation

dire blade
#

uhhhhhhhh

#

the latest github commit doesn't generate a config file

charred pasture
#

erm

dire blade
#

and it doesn't generate blocks

charred pasture
#

did you remove your old config file

dire blade
#

yeah

charred pasture
#

and generate a new one

#

erm

dire blade
#

yeah it doesn't make one

charred pasture
#

one hefty name

#

AdditionalItemAssetRegistrationCallbackContextImpl

charred pasture
woven nest
woven nest
dire blade
#

how exciting

dire blade
#

but it can't write so yeah

#

I have genuinely no idea why it's doing this

#

when I updated and had a valid config it also registered nothing

charred pasture
#

huh

woven nest
charred pasture
#

okay

#

well ill try it out

charred pasture
#
            var success = CONFIG_FILE.getParentFile().mkdirs();
            if (!success) {
                IllicitBlocks.LOG.warn("Failed to write directories");
                return;
            }
dire blade
#

hmm

charred pasture
#

probably something wrong

#

like

#

ill push a new update rn to that file

#

so two events

#
        AdditionalItemAssetRegistrationCallback.EVENT.register(context -> {

        });

        AdditionalModelRegistrationCallback.EVENT.register(context -> {

        });
dire blade
#

hmmmmmmm

charred pasture
#

suppose its just this

#
        AdditionalItemAssetRegistrationCallback.EVENT.register(context -> {
            IllicitBlocks.blocksToHandle.forEach(id -> {
                context.addAsset(id, new ItemAsset(
                        new BasicItemModel.Unbaked(
                                id,
                                List.of()
                        ),
                        ItemAsset.Properties.DEFAULT
                ));
            });
        });

        AdditionalModelRegistrationCallback.EVENT.register(context -> {
            IllicitBlocks.blocksToHandle.forEach(id -> {
                context.addModel(id, JsonUnbakedModel.deserialize(new StringReader("")));
// do more stuff here
            });
        });
woven nest
charred pasture
#

ah

#

well this probably looks nicer

#

wow its invisible

#
        AdditionalItemAssetRegistrationCallback.EVENT.register(context -> {
            IllicitBlocks.blocksToHandle.forEach(id -> {
                context.addAsset(id, new ItemAsset(
                        new BasicItemModel.Unbaked(
                                id,
                                List.of()
                        ),
                        ItemAsset.Properties.DEFAULT
                ));
            });
        });

        AdditionalModelRegistrationCallback.EVENT.register(context -> {
            /*
            IllicitBlocks.blocksToHandle.forEach(id -> {
                context.addModel(id, JsonUnbakedModel.deserialize(new StringReader("")));
            }); */

            StringReader modelJsonStringReader = new StringReader("""
                                {
                                    "model": {
                                        "type": "minecraft:model",
                                        "model": "minecraft:block/piston_head"
                                    }
                                }
                    """);

            context.addModel(Identifier.ofVanilla("piston_head"), JsonUnbakedModel.deserialize(modelJsonStringReader));
        });
#

[22:31:59] [Worker-Main-4/WARN] (Minecraft) Missing texture references in model minecraft:piston_head:
particle

woven nest
#

funn

woven nest
#

I'm not either

#

supposedly it's defined in place in the template

charred pasture
#

so odd

#

this works

#
{
  "parent": "block/piston_head",
  "textures": {
    "texture": "block/piston_top",
    "particle": "block/piston_top"
  }
}
dire blade
dire blade
woven nest
#
{
  "parent": "block/piston_head"
}
dire blade
#

but you can't break items so yeah

charred pasture
#

ok trying

charred pasture
woven nest
#

yeah

#

I'm stupid for not seeing that

charred pasture
woven nest
#
{
  "model": {
    "type": "minecraft:model",
    "model": "minecraft:block/piston_head"
  }
}
``` this is the item asset file
#
{
  "parent": "block/piston_head",
  "textures": {
    "texture": "block/piston_top",
    "particle": "block/piston_top"
  }
}
``` this is the item model file
#

they are not the same

charred pasture
#

ah

#

i kind of forgot the difference

#

between item asset and model

#

brain fart

woven nest
#

it's like blockstate file and block model file

#

hence why there were people campaigning to call them ItemStates

#

but those people lost

charred pasture
#

wow

#

who are these people

dire blade
charred pasture
#
{
  "parent": "block/piston_head",
  "gui_light": "front"
}
#

makes it not dark in gui

dire blade
#

oooo

charred pasture
#

probably gonna do some weird gson

#

stuff instead of having to

#

do the actual string

woven nest
#

you'll probably want to check context.hasModel(id)

dire blade
#

well we have flat items now and we know how to fix the dark model crisis

charred pasture
#
        AdditionalModelRegistrationCallback.EVENT.register(context -> {
            IllicitBlocks.blocksToHandle.forEach(id -> {
                if (context.hasModel(id)) return;
#

resource pack support

dire blade
#

hmm

charred pasture
#

alright im gonna do something similar to this

#

and handle if its certain blocks

#

            JsonObject jsonRoot = new JsonObject();
            jsonRoot.addProperty("parent", "block/piston_head");
            jsonRoot.addProperty("gui_light", "front");

            context.addModel(Identifier.ofVanilla("piston_head"), JsonUnbakedModel.deserialize(new StringReader(jsonRoot.toString())));
woven nest
#
new JsonUnbakedModel(null, UnbakedModel.GuiLight.ITEM, null, null, ModelTextures.Textures.EMPTY, Identifier.ofVanilla("block/piston_head"))
charred pasture
#

nice

woven nest
#

okay

#

one mistake lol

charred pasture
#

huh

woven nest
#

apparently that isn't nullable

charred pasture
#

okay

#

is it flexible

#

as the jsonobject + deserialize

#

im not on pc rn

woven nest
#

idk what you need from "flexible"

#

it can do everything the json can do

charred pasture
#

hmm

woven nest
#

because it's what the json turns into

dire blade
#

what is debug mode

woven nest
#

but idk

charred pasture
#

i probably just need to

#

look into

#

your resource pack more

charred pasture
#

if it's true

#

it prints out debug information

#

of a lot of stuff

#

if it's false

#

it prints out basic information

#

so theres less log spam

woven nest
#

-# when you're in a modpack, every log spammer adds up

charred pasture
dire blade
#

uhhh

#

latest commit doesn't properly create a static list

charred pasture
#

erm

dire blade
#

oh also with both options set to false

#

static and register

#

it somehow crashes

charred pasture
#

erm

#

logs

dire blade
#

I have remove reloading screen enabled

#

or I actually don't

#

I swear terrestria is like the mod from hell with this

charred pasture
#

you should probably install

#

flite to remove that

#

annoying error message

#

(unrelated)

woven nest
#

-# ah yeah lol it's the hasModel error.

#

-# that will need to be in the javadoc

charred pasture
#

huh

woven nest
#
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Attempting to add duplicate ItemAsset definition
charred pasture
#

Caught error loading resourcepacks, removing all selected resourcepacks
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Attempting to add duplicate ItemAsset definition

#

nice

#

resource pack added an existing thing

#

the mod trying to add its own thing

woven nest
#

hasAsset also exists btw

charred pasture
#

yes

#

i forgot that i committed it

dire blade
#

so what happens is visually

#

it shows the loading screen

charred pasture
#

gotta add a check here

#

IllicitBlocks.blocksToHandle.forEach(id -> {
context.addAsset(id

dire blade
#

then it just goes back to the start and the window goes black

dire blade
#

terrestria now has the status of basically being the mod from hell

#

no idea if terrestria is doing this though but I think it still deserves it

#

yeah

#

it is

#

the game boots without terrestria

charred pasture
#

let me fix

#

kinda nice ig

#

rn only does the

#

block/item_path

#

thing

#

alright

#

@dire blade i pushed some commits

#

shouuld hopefully fix it

#
        AdditionalItemAssetRegistrationCallback.EVENT.register(context -> {
            IllicitBlocks.blocksToHandle.forEach(id -> {
                if (context.hasAsset(id)) return;

                context.addAsset(id, new ItemAsset(
                        new BasicItemModel.Unbaked(
                                id,
                                List.of()
                        ),
                        ItemAsset.Properties.DEFAULT
                ));
            });
        });

        AdditionalModelRegistrationCallback.EVENT.register(context -> {
            IllicitBlocks.blocksToHandle.forEach(id -> {
                if (context.hasModel(id)) return;

                JsonObject jsonRoot = new JsonObject();
                jsonRoot.addProperty("parent", "block/" + id.getPath());
                jsonRoot.addProperty("gui_light", "front");

                context.addModel(id, JsonUnbakedModel.deserialize(new StringReader(jsonRoot.toString())));
            });
        });
#

tomorrow ill add onto it

#

maybe then blockstates

#

also gonna publish to modrinth even if its unfinished

#

so that when its time for review is not gonna take long

#

under review now

dire blade
#

yay

charred pasture
#

try latest commit

#

should work

#

it should be functional

#

in terms of

#

like how the user sees it

#

except i also

#

made it so it uses gui_light: front

dire blade
#

yep it does

dire blade
charred pasture
#

yes

#

it should be like uh

#

built in resource pack

dire blade
#

well modrinth has an addon thing

charred pasture
#

really

#

okay i'll see

dire blade
#

yeah I believe so

#

I also give you permission to license it under GPL 3.0 because licensing stuff

charred pasture
#

okay

#

so for tomorrow

#

if the block is a fluid

#

add in _still

dire blade
#

yep

#

if it is a crop

#

_stage0

#

sweet berry bushes also have this

#

unsure if they are labeled as a crop

charred pasture
#

hmm

dire blade
#

yeah

charred pasture
#

also im thinking

#

we should remove the hot key entirely

#

just make it run after the client loads (registry frozen at that point, so can safely check what blocks dont have an block item)

#

less manual work

#

and well

#

the player has to relaunch the game

#

so how should the mod tell you that

charred pasture
#

just in case people add in new mods or remove new mods

#

idk

#

or just handle that when the client finishes loading

dire blade
#

and possibly merge the old system into the new system

#

so it'll of course do the thing it has always done

#

but if it crashes then on the next startup it'll fall back

#

and you'll have to restart the game

charred pasture
#

so i think it'll go something like this

#

first boot with illicit

#

mod pack finishes loading
illicit dumps blocks

#

user relaunches minecraft and sets config to true (maybe the code should set the config to true automatically)

#

so illicit will always dump blocks

#

on start

#

so that any mod changes are applied to next relaunch of minecraft

#

i think that the mod should always dump mc

#

but for other mods

#

only the first time and whenever you add/remove new mods you'll have to relaunch

#

to support them

dire blade
#

maybe add a toast or something to tell the user that they need to restart the game

charred pasture
#

yes

charred pasture
#

then maybe remove the

#

unnecessary config options

dire blade
charred pasture
#

so then like

#

the config should be

dire blade
#

keep the inclusion and exclusion

#

might have some specific use case (especially exclusion)

charred pasture
#

excluded_identifiers = {}
excluded_namespaces = {}

#

then

#

debug = true/false

dire blade
#

yeah

charred pasture
#

block_list = {} (will replace static list)

#

use static list will be renamed

#

to first_boot: true/false

#

register block items will be removed

#

block item registering will only be done when first boot is false

dire blade
#

since the other system doesn't really exist anymore

charred pasture
#

i think that's the new config

dire blade
charred pasture
dire blade
#

yeah

charred pasture
#

so just rename it to that

dire blade
#

that's more descriptive of what it actually is

charred pasture
#

okay

#

only really necessary for non minecraft blocks

dire blade
#

yeah

#

if you disable it expect potential crashes with mods like terrestria

#

terrestria probably has been like the main source of wonky problems here

#

but better testing = a better mod

#

also the mod isn't out of review yet

charred pasture
#

yes

#

modrinth mods

#

usually take 24-48 hours officially

#

the first mod i published

#

it took more than 48 hours

charred pasture
#

btw do you want to include

#

optionally include

#

to install yetanotherconfiglibrary

#

so you can change config from inside mc

dire blade
charred pasture
#

okay

#

so minimal dependencies

dire blade
#

yeah

charred pasture
#

minimal required* dependencies

dire blade
#

this will help with backporting and stuff too

charred pasture
#

yes

#

less dependencies easier backporting

dire blade
#

yep

dire blade
charred pasture
#

i'll focus on the core stuff

#

instead of the yacl first

dire blade
#

unless the model stuff doesn't require modern things

#

backported versions will be quite broken

charred pasture
#

yes

#

the mod is already like

dire blade
#

but it's fine if it's just the core functionality

charred pasture
#

some what deeply integrated

#

into the current version

dire blade
#

yeah

#

blockstates would solidify that even further

charred pasture
#

yes

#

then id have to create

#

separate versions of the mod

#

for certain mc versions

dire blade
#

yeah

#

and that isn't a very great experience

charred pasture
#

so true

#

having to back port and forward port features

dire blade
#

yeah

charred pasture
#

across multiple versions

dire blade
#

future stuff should be fine

#

but stuff in the past will need a bit of help

#

one of the versions I'm curious to get working with this is 24w14potato

#

just so many blocks

charred pasture
#

does it already work

dire blade
#

no

#

however it is one of the earliest versions of the game with components so in theory it could even work with blockstates

#

and it probably would

#

forgot what made booting it impossible

charred pasture
dire blade
#

the mod is built for java 21

#

that's what it is

#

I bet I might be able to compile in java 17

#

but not now

charred pasture
#

an

charred pasture
#
                JsonObject jsonRoot = new JsonObject();
                jsonRoot.addProperty("parent", "block/" + id.getPath());
                jsonRoot.addProperty("gui_light", "front");

                if (block instanceof FluidBlock) {
                    jsonRoot.addProperty("parent", "minecraft:item/generated");

                    JsonObject textures = new JsonObject();
                    textures.addProperty("layer0", id.getNamespace() + ":block/" + id.getPath() + "_still");

                    jsonRoot.add("textures", textures);

                    IllicitBlocks.LOG.info("FLuid json {}", jsonRoot.toString());
                }

                if (block instanceof CropBlock) {
                    jsonRoot.addProperty("parent", "block/" + id.getPath() + "_stage0");
                }

#

seems to work

#

for fluids and crops

#

holy pitcher block using stage_0 instead

charred pasture
#

wall banner broken for some reason

#

what it generated as the model json

#
{
  "gui_light": "front",
  "parent": "minecraft:item/wall_banner",
  "textures": {
    "base": "minecraft:block/cyan_banner"
  }
}
#

what your resource pack says

#
{
  "parent": "minecraft:item/wall_banner",
  "textures": {
    "base": "minecraft:block/purple_banner"
  }
}
#

wait maybe cause

#

the parent is kinda wrong ig

charred pasture
charred pasture
#

think i've figured it out

#

without having to hard code it

#

yep

#
                List<TintSource> tintSources = new ArrayList<>();

                if (id.equals(Identifier.ofVanilla("water"))) {
                    tintSources.add(new ConstantTintSource(ColorHelper.getArgb(63, 118, 228)));
                }

                if (block instanceof WallBannerBlock wallBannerBlock) {
                    // do things here...
                    context.addAsset(id, new ItemAsset(
                            new SpecialItemModel.Unbaked(
                                    Identifier.ofVanilla("item/template_banner"),
                                    new BannerModelRenderer.Unbaked(wallBannerBlock.getColor())
                            ),
                            ItemAsset.Properties.DEFAULT
                    ));
                    return;
                }



                context.addAsset(id, new ItemAsset(
                        new BasicItemModel.Unbaked(
                                id,
                                tintSources
                        ),
                        ItemAsset.Properties.DEFAULT
                ));
#

doing the wall signs and hanging wall signs

#

wood type get namespaced somehow

#
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name jungle
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name dark_oak
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name pale_oak
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name mangrove
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name bamboo
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name crimson
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name warped
[12:44:54] [Worker-Main-1/INFO] (illicitblocks) wood type name biomesoplenty:fir
#
Caused by: com.google.gson.JsonParseException: biomesoplenty:item/biomesoplenty:fir_sign is not valid resource location

#

wall signs work now

#

terrestria doing something different again

#

bop and mc works

#

wtf ๐Ÿ’€

#

the woodtype for the terrestria signs

#

are all oak

#

for some reason

#
[12:52:54] [Worker-Main-2/WARN] (Minecraft) Missing textures in model terrestria:japanese_maple_wall_sign:
    minecraft:textures/atlas/blocks.png:terrestria:item/oak_sign
[12:52:54] [Worker-Main-2/WARN] (Minecraft) Missing textures in model terrestria:yucca_palm_wall_sign:
    minecraft:textures/atlas/blocks.png:terrestria:item/oak_sign
woven nest
#

They likely override it in the ber

charred pasture
#

hmm

#

its not good when

#

the folders are rearranged a bit differently

charred pasture
#

blockentityrenderer

#

this is the entire

#

clientmodinitializer

#

wait

#

let me go to 1.21.5 branch

#

damn i think this is why

#

trying to find the renderer

charred pasture
#

they dont have any custom renderers

charred pasture
#

okay so im just gonna

#

parse the wood type from the name

charred pasture
charred pasture
charred pasture
#

heads are done

#

lol

charred pasture
#

messing around with the toast

#

oops

lime glacier
#

Maybe off-topic, but is there a TL;DR for this thread?

#

I'm curious about how 2742 messages came to be

charred pasture
#

basically

#

the original mod idea was

#

to register missing block items for blocks

#

and maybe blockstates for said blocks

lime glacier
#

Oh

#

I see

#

Thanks for the answer

#

You can carry on

charred pasture
#

it got a bit more complicated

#

and it's still not complicated enough

#

to do block states

charred pasture
charred pasture
charred pasture
#

gonna commit and push what i have soon

dire blade
#

this went way better than I could've expected today

charred pasture
#

okay im gonna push

#

but there is a race condition

#

that sometimes modded blocks get registered

#

sometimes they dont

#

ok i pushed

woven nest
#

Could just be modinit order

charred pasture
#
    private BlockStateBlockItem tryRegisterBlock(Identifier id) {
        if (!shouldHandleBlock(id)) {
...
public static boolean shouldHandleBlock(Identifier blockId) {
#
    private ArrayList<BlockStateBlockItem> registerBlockItems() {
        ArrayList<BlockStateBlockItem> collected = new ArrayList<>();
        AtomicBoolean hasModdedContent = new AtomicBoolean(false);

        Registries.BLOCK.forEach(block -> {
            Identifier id = Registries.BLOCK.getId(block);
            if ("minecraft".equals(id.getNamespace())) {
                BlockStateBlockItem item = tryRegisterBlock(id);
                if (item != null) collected.add(item);
            } else {
                hasModdedContent.set(true);
            }
        });

        for (Identifier id : moddedBlocks) {
            BlockStateBlockItem item = tryRegisterBlock(id);
            if (item != null) collected.add(item);
        }
#
    @Override
    public void onInitialize() {
        ConfigManager.loadConfig();
        DEBUG_LOGGING = ConfigManager.config.debug;
        moddedBlocks = ConfigManager.config.modded_block_list.stream()
                .map(Identifier::of)
                .collect(Collectors.toCollection(ArrayList::new));

        Registry.register(Registries.ITEM_GROUP, ILLICIT_BLOCKS_ITEM_GROUP_KEY, ILLICIT_BLOCKS_ITEM_GROUP);

        ArrayList<BlockStateBlockItem> blockItems = registerBlockItems();
#
    public static boolean shouldHandleBlock(Identifier blockId) {
        if (ConfigManager.config.included_identifiers.contains(blockId.toString())) {
            Utils.debugLog("In included identifiers, returning true for {}", blockId);
            return true;
        }

        if (ConfigManager.config.excluded_identifiers.contains(blockId.toString()) || ConfigManager.config.excluded_namespaces.contains(blockId.getNamespace())) {
            Utils.debugLog("In excluded identifiers OR namespace, returning false for {}", blockId);
            return false;
        }

        return Registries.BLOCK.get(blockId) != Blocks.AIR && !Registries.ITEM.containsId(blockId);
    }
woven nest
#

Try looking into the RegistryEntryAddedCallback

charred pasture
#

hmm

#

that a listener for new registry entrys

woven nest
#

There is also one for all existing, and all future

charred pasture
#

what should i do with it

woven nest
charred pasture
#

oh

#

all existing?

#

future is probably that registryentryaddedcallback

woven nest
#

No, but there is a combined one

#

For both together

charred pasture
#

ah

woven nest
#

RegistryEntryAddedCallback.allEntries

#

The only mild worry is if they register their items after their blocks

charred pasture
#

whats the difference

#

between that and manually going over registries.ITEM/BLOCK

woven nest
#

Manually iterating the registry misses anything after the point when you do it

#

And mod loading order, and thus registration order, is undefined

charred pasture
#

ah

woven nest
#

So you may randomly miss whole mods of blocks / items

#

That said

#

There is probably a happy medium

dire blade
#

I don't want the mod to miss things

woven nest
#

Maybe mixin just before the freeze and register there

dire blade
woven nest
dire blade
#

I have brought it up before

charred pasture
#

i think it would be doable

woven nest
#

It's all java, and it's all done at once

dire blade
#

yeah

dire blade
woven nest
#

Fapi makes it mildly annoying because it defers it until after modinit, but it's still not too bad

dire blade
woven nest
#

That was never in question

dire blade
#

with registration we have no idea if terrestria does this

woven nest
#

Huh?

dire blade
woven nest
#

Every one registers before the freeze

#

Because you can't after

#

The game will crash

dire blade
#

I mean right before like we have here

charred pasture
#

would it conflict with other mods

#

cause if this didnt then it would be awesome

#

fully dynamic

dire blade
#

yeah

woven nest
charred pasture
#

okay

woven nest
#

You could probably use waifu to make sure if you want

charred pasture
#

wtf is waifu

woven nest
#

What am I fucking up

#

It's neoforges index of every entry on modrinth

#

It will let you search by similar area mixins

charred pasture
#

wow

#

thats honestly crazy

#

never knew such a tool existed

woven nest
#

It's quite powerful

charred pasture
woven nest
#

And large lol

charred pasture
#

Registries.freezeRegistries

woven nest
#

And fapi doesn't screw with it?

charred pasture
#

do u have a link

woven nest
woven nest
#

I haven't needed to use it

charred pasture
woven nest
charred pasture
woven nest
#

The publuc name isn't quite as good lol

#

But yeah, that's it

charred pasture
#

holy hell

#

16 gigs of ram recommende d

#

setting up postgres

woven nest
#

You don't need to run it

#

Just find neos instance

charred pasture
#

ah

woven nest
#

They have a public one somewhere

#

Oh, hey, apparently it does curseforge too

charred pasture
#

ah

#

idk how to exactly search up

woven nest
#

Idk either

#

I know it's capable of it lol

#

But

woven nest
#

-# I don't fuck up /j

charred pasture
#
        RegistryEntryAddedCallback.allEntries(Registries.BLOCK, refBlock -> {
            Block block = refBlock.value();
            Identifier id = Registries.BLOCK.getId(block);

            if ("minecraft".equals(id.getNamespace())) {
                BlockStateBlockItem item = tryRegisterBlock(id);
                if (item != null) collected.add(item);
            } else {
                if (moddedBlocks.contains(id)) {
                    BlockStateBlockItem item = tryRegisterBlock(id);
                    if (item != null) collected.add(item);
                }
                hasModdedContent.set(true);
            }
        });
#

gonna see if this fixes the race condition

charred pasture
dire blade
#

testing latest

charred pasture
#

okay

dire blade
#

hmm

#

it appears that

#

the notification goes off screen

#

at 854x480

charred pasture
#

erm

#

im using the vanilla toast stuff

#

so that'll happen with vanilla mc

#

too

dire blade
#

I am thoroughly impressed

#

like literally

#

I thought I was using my own pack for a moment

charred pasture
#

what should i do next

#

apart from trying

#

to uh

#

add more dynamic

#

models

#

how would blockstate backwards compatibility work

dire blade
charred pasture
#

how did it even work back then

#

was there even the concept of a block state

#

apparently they had metadata

#

0-15

woven nest
#

Much more than just 15, but yeah

charred pasture
#

{ "block": "minecraft:planks", "meta": 5 }

#

imagine trying to find out

#

what this planks looks like

woven nest
#

1.14 was after the flattening though, thankfully

charred pasture
#

block state component

#
Minecraft Wiki

Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.
Data components are used in various places, including the player's inventory, container block enti...

dire blade
charred pasture
#

hmm

dire blade
#

but we should focus on like

#

actually getting stuff to work on 1.20.4 and Java 17

#

I tried setting stuff up for 24w14potato and 24w13a and it definitely did not want to compile

#

I'm quite unlucky because 1.20.4 is NBT but 1.20.5 is Java 21

charred pasture
#

wdym 1.20.4 is nbt

#

and 1.20.5 is java 21

dire blade
#

so 24w14potato was the very last version to be on Java 17

#

and 24w09a (the first 1.20.5 snapshot) implemented components

#

so all versions before used nbt

charred pasture
#

thats crazy

#

i believe mc

#

still uses a mix of nbt

#

and components

#

by the way i think i finished porting

#

some of the stuff

#

however i do believe that i can probably just use

#

static json files

#

for some of the blocks

#

especially just like this

dire blade
#

I think if we can get stuff back to 1.20.4

#

we could go as far as registration library stuff limits us

dire blade
#

like pretty high priority should probably be finding out how to get end gateway + end portal

#

also with moving piston

#

it's blank

#

I guess that's fine

#

but I think it's probably safe to hardcode that one to be a dimmed piston face

#

but related to the placement system

charred pasture
#

im trying to make the placement system

#

work

dire blade
#

yeah

charred pasture
#

with blockstate components

dire blade
#

like you can place blocks inside yourself and replace other illicit blocks

#

so you can easily get rid of moving pistons without /setblock

#

which obviously is quite weird

charred pasture
#

erm

dire blade
#

I think all it needs is vertical placement and checks to not build inside yourself and other blocks

#

also is there still the north issue

#

haven't tested stuff but yeah

charred pasture
#

wdym byvertical

#

placement

dire blade
#

like if you place a block on a ceiling or on the ground

#

it will face down or up respectively

#

also it still does the north thing

charred pasture
charred pasture
#

facing in the six directions

dire blade
#

hmm

dire blade
#

on the modrinth side it appears that we're quite unlucky

#

still isn't up yet

charred pasture
#

less than 48 hours

warm mirage
#

it's usually around a week while there's a review delay (like there is rn)

dire blade
charred pasture
#

@dire blade is it fine if the player can only place it where it can normally be placed

#

more vanilla behavior

#

well

woven nest
charred pasture
#

weak review

woven nest
#

-# let's insult the review process until it accepts you /j

charred pasture
#

the last time it took about two-three days

#

only things i changed

#

before i overrided the entire useOnBlock

#
    @Override
    protected @Nullable BlockState getPlacementState(ItemPlacementContext context) {
        BlockState blockState = super.getPlacementState(context);
        if (blockState != null && blockState.contains(Properties.FACING)) {
            blockState = blockState.with(Properties.FACING, context.getHorizontalPlayerFacing().getOpposite());
        }

        return blockState;
    }

    @Override
    protected boolean canPlace(ItemPlacementContext context, BlockState state) {
        return true;
    }
#

seems to work

#

can only place wall torches on walls

#

without overriding the getplacement state

#

the piston head doesn't change the facing

#

cocoa on logs

#

hanging signs only on the side of blocks (and bottom)

#

everything looks like its working as expected

#

(placing random blocks)

#

atleast from the random selection ive chosen

#

also

#

something stupid i did was

#

i set the blockstate of redstone wall torch lit property to false

#

and i was confused on why it didnt stay unlit

#

well thats cause the redstone wall torch actually checks if its being powered and then changes its state accordingly

#

i should try testing it with the piston head

charred pasture
#

well i guess it works

#

ill try generating all variations of the blockstate for one block at first

#

gonna be too polluted without

#

this code only for testing purposes

#
        Optional<BlockStateBlockItem> match = blockItems.stream()
                .filter(item -> Registries.BLOCK.getId(item.getBlock()).getPath().equals("piston_head"))
                .findFirst();

        ItemStack pistonHead = new ItemStack(match.get());
        pistonHead.set(
                DataComponentTypes.BLOCK_STATE,
                new BlockStateComponent(BlockStateComponent.DEFAULT.properties())
                        .with(Properties.PISTON_TYPE, PistonType.STICKY)
        );
        pistonHead.set(
                DataComponentTypes.ITEM_NAME,
                Text.literal("TESTING")
        );
charred pasture
#

so they cant place it where the player is

#

pushed an commit to change the blockstateblockitem

#

well the name is probably not good

#

cause im just using components

#
        for (BlockState state : pistonHeadBlockItem.getBlock().getStateManager().getStates()) {
            ItemStack pistonHead = new ItemStack(pistonHeadBlockItem);
            BlockStateComponent blockStateComponent = new BlockStateComponent(BlockStateComponent.DEFAULT.properties());
            
            // TODO: ignore facing property
            for (Property<?> property : state.getProperties()) {
                blockStateComponent = blockStateComponent.with(property, state);
            }

            pistonHead.set(DataComponentTypes.BLOCK_STATE, blockStateComponent);
            pistonHead.set(DataComponentTypes.ITEM_NAME, Text.literal("Testing"));
            itemStacks.add(pistonHead);
        }
#

i think this is an appropriate way

#

seems to work

#

gonna try doing it for all blocks