#Technical blocks
1 messages ยท Page 3 of 1
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
alright
and then it shouldn't affect the actual item id
only used for rendering the model
You probably want to store the actual state in a component as well
String parsing is expensive, and doing it every frame is moreso
yea
for mc blocks
they don't store blockstate components
they generate the blockstate each time you place
based on the current context
they already are components
so like
water[minecraft:block_state={"level":"5"}] works
might have screwed up the quotes but you get the idea
yeah
but no tooltip
so I think just go through all blocks and their blockstates and give them tooltips
using components
by this you mean no tooltip component
are you able to give an example right now? im not on pc
it's fine if you can't
i'll try to figure it out later on pc
I think
like there is probably a label component
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
Me neither lol
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
You'd probably sooner register an appender than use lore
Lore is mostly for datapackers
yeah
oh with biomesoplenty
it registers blood and liquid null
so unmodded you could have them
huh
yeah
what's it
biomes o plenty
yeah
I couldn't find them in the creative inventory but they were accessible with /give
with /gove
yeah
give
I looked at the item and it wasn't in illicitblocks
yes
since they already had
items
yeah
I had forgotten about them already being registered
also for some reason the models are hardcoded to be nothing
wait so
it's nothing
it's invisible?
in inventory yeah
well
it's probably something internal
don't think
like
i think you were supposed to use the bucket
to place
the fluids instead
yeah
it's probably a rendering fail
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
yes
probably cause
the python script
generates
with a block model
template_json = """
{{
"model": {{
"type": "minecraft:model",
"model": "{}:block/{}"
}}
}}
"""
@dire blade do you have your resource pack
of the thing you manually did for the models
i want to see it
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
oo nice
would be very nice additions
to fapi
we'll see. I'm waiting for pepper to look at the first thing before I actually make a pr
sure
yeah
give me a moment
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
all others should point to the block name
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
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
yay
i'll wait for a better implementation
yeah
we just need
to make it generate different stuff for different tags
right now
i'll just implement
your idea
yeah
yeah
^
(i have no idea what's going on or how it worked)
this is the guideline for models basically
okay
it should be pretty simple
and cover most stuff
we already have models for the other stuff so that's nice
yeah
automatically
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
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());
}
random block i made
hmm
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
they can be
but for water I could not find tint info
wait so
other items like foliage can have it though
your water is white too?
yeah
oh speaking of my pack
r3 includes wall banners
wall banners have a special template
okay
but it relies on custom images being in minecraft/blocks
wall banners will have to likely be hardcoded
okay
yeah
so just put in the root of the source
wait
give me a moment
the banner color pointers in /items
huh
/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
do you think
we should just apply your
resource pack
and then whatever models are missing
dynamically generate them
before hardcoding stuff (except for the torchflower and wall banners)
I want everything to work
yeah
you want to see if it works first
exactly
yeah
hardcoded is like
last resort stuff
hardcoded and thus missing block models
missing textures
stuff like that
yeah of course
but that's kinda lazy and we need it to work with mods
YES
I was just starting to mess with the weird integer colors in items
it was already driving me insane
lol
my gist has been updated. It looks like the fapi pr probably won't come until later, but you're welcome to copy and paste if you wish
so these weird values are ARGB to int
Okay
minecraft like
packs colors
yeah
into integers
it's weird
you gotta do some math
potions are like that too
it's not bad if you work in hex though
if you want to turn a rgb color into that int so thats why
theres a ColorHelper
thingy
yep
I remember years back
the pain of trying to find the right color
completely guessing
what changed
or did you do some refactors
ah
i see it now
I added a model adding callback
-# and unrelated qol brainstorming for the pr
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
I mean
it is a JsonUnbakedModel
but I get the point
technically it takes any UnbakedModel
so you could implement it yourself as well
i implemented using jsonunbakedmodel
oh i see
your actually using a
json unbaked model
without using the
deserialize
yeah
didnt see that
deserializer is preferred, but in situations like this, it's more convenient to just register the model
yeah i think so too
you get auto completion in intellij and less need to verify the json works

hmm
hopefully it works even though I have completely forgotten everything
these events come after resource pack provided models, and have a way to get them, so. you should be able to determine if a resource pack has provided a model, and not provide yours
okay
i suppose i can just use a deserializer
instead of having to do the
building it piece by piece
do whatever works
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
but it might work I guess so that's all that matters
erm
and it doesn't generate blocks
did you remove your old config file
yeah
yeah it doesn't make one
any logs
if your doing it all throught the AddAsset callback, then you don't need any of the new stuff I added
yeah. prefering descriptive stuff rn, because when I make a pr, it will just get eaten by the model loading plugin
wdym
then it says there's no config file
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
huh
I honestly don't know.
var success = CONFIG_FILE.getParentFile().mkdirs();
if (!success) {
IllicitBlocks.LOG.warn("Failed to write directories");
return;
}
hmm
probably something wrong
like
ill push a new update rn to that file
so two events
AdditionalItemAssetRegistrationCallback.EVENT.register(context -> {
});
AdditionalModelRegistrationCallback.EVENT.register(context -> {
});
hmmmmmmm
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
});
});
the way you were doing it, you didn't need the second one.
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
funn
not sure what this means
so odd
this works
{
"parent": "block/piston_head",
"textures": {
"texture": "block/piston_top",
"particle": "block/piston_top"
}
}
that's fine
what if you do
because you're likely basing it off of a block model
{
"parent": "block/piston_head"
}
it wants a particle
but you can't break items so yeah
ok trying
yes that works
{
"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
it's like blockstate file and block model file
hence why there were people campaigning to call them ItemStates
but those people lost
yes
{
"parent": "block/piston_head",
"gui_light": "front"
}
makes it not dark in gui
oooo
probably gonna do some weird gson
stuff instead of having to
do the actual string
you'll probably want to check context.hasModel(id)
well we have flat items now and we know how to fix the dark model crisis
yes
AdditionalModelRegistrationCallback.EVENT.register(context -> {
IllicitBlocks.blocksToHandle.forEach(id -> {
if (context.hasModel(id)) return;
resource pack support
hmm
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())));
new JsonUnbakedModel(null, UnbakedModel.GuiLight.ITEM, null, null, ModelTextures.Textures.EMPTY, Identifier.ofVanilla("block/piston_head"))
nice
huh
apparently that isn't nullable
hmm
because it's what the json turns into
what is debug mode
but idk
debug mode
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
-# when you're in a modpack, every log spammer adds up

erm
I have remove reloading screen enabled
or I actually don't
I swear terrestria is like the mod from hell with this
you should probably install
flite to remove that
annoying error message
(unrelated)
huh
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Attempting to add duplicate ItemAsset definition
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
hasAsset also exists btw
gotta add a check here
IllicitBlocks.blocksToHandle.forEach(id -> {
context.addAsset(id
then it just goes back to the start and the window goes black
lol
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
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
yay
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
yep it does
you should also include my pack as an addon
well modrinth has an addon thing
yeah I believe so
I also give you permission to license it under GPL 3.0 because licensing stuff
yep
if it is a crop
_stage0
sweet berry bushes also have this
unsure if they are labeled as a crop
hmm
yeah
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
no, wait maybe just keep it in
just in case people add in new mods or remove new mods
idk
or just handle that when the client finishes loading
yeah I think that's the way to do it
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
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
yeah
yeah I think that's how it should be
maybe add a toast or something to tell the user that they need to restart the game
yes
maybe like this
New block items found, please restart the game to register items
keep the inclusion and exclusion
might have some specific use case (especially exclusion)
yeah
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
since the other system doesn't really exist anymore
i think that's the new config
create_list_after_freeze: true
(minecraft will stay, block item registering for mc always on)
yeah
that's more descriptive of what it actually is
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
yes
modrinth mods
usually take 24-48 hours officially
the first mod i published
it took more than 48 hours
why not bop
btw do you want to include
optionally include
to install yetanotherconfiglibrary
so you can change config from inside mc
it should be optional
yeah
minimal required* dependencies
this will help with backporting and stuff too
yep
I think that
unless the model stuff doesn't require modern things
backported versions will be quite broken
but it's fine if it's just the core functionality
yes
then id have to create
separate versions of the mod
for certain mc versions
yeah
across multiple versions
hopefully
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
does it already work
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
so real
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
an
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
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
ah
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
Isn't it an enum?
They likely override it in the ber
BER as in
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

(this is true now)
they dont have any custom renderers
they just do it like this
okay so im just gonna
parse the wood type from the name
Maybe off-topic, but is there a TL;DR for this thread?
I'm curious about how 2742 messages came to be
basically
the original mod idea was
to register missing block items for blocks
and maybe blockstates for said blocks
it got a bit more complicated
and it's still not complicated enough
to do block states
gonna commit and push what i have soon
okay im gonna push
but there is a race condition
that sometimes modded blocks get registered
sometimes they dont
ok i pushed
How are you iterating the registry?
Could just be modinit order
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);
}
Try looking into the RegistryEntryAddedCallback
There is also one for all existing, and all future
what should i do with it
Idr where though
ah
RegistryEntryAddedCallback.allEntries
The only mild worry is if they register their items after their blocks
which i think some do
whats the difference
between that and manually going over registries.ITEM/BLOCK
Manually iterating the registry misses anything after the point when you do it
And mod loading order, and thus registration order, is undefined
ah
So you may randomly miss whole mods of blocks / items
That said
There is probably a happy medium
I don't want the mod to miss things
Maybe mixin just before the freeze and register there
finding the exact event time would be hard
lol
Not really
I have brought it up before
i think it would be doable
It's all java, and it's all done at once
yeah
but the question is
Fapi makes it mildly annoying because it defers it until after modinit, but it's still not too bad
will terrestria drive us insane
with registration we have no idea if terrestria does this
Huh?
registering blocks before freezing
I mean right before like we have here
would it conflict with other mods
cause if this didnt then it would be awesome
fully dynamic
yeah
It shouldn't?
okay
You could probably use waifu to make sure if you want
wtf is waifu
What am I fucking up
It's neoforges index of every entry on modrinth
It will let you search by similar area mixins
It's quite powerful
And large lol
Registries.freezeRegistries
And fapi doesn't screw with it?
To be fair, the one exception I know of for this is the dimension registry
Chemistry rules moment
People do the cursed and unfreeze it using fantasy
ah
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
testing latest
okay
I am thoroughly impressed
like literally
I thought I was using my own pack for a moment
what should i do next
apart from trying
to uh
add more dynamic
models
how would blockstate backwards compatibility work
it wouldn't
how did it even work back then
was there even the concept of a block state
apparently they had metadata
0-15
Much more than just 15, but yeah
{ "block": "minecraft:planks", "meta": 5 }
imagine trying to find out
what this planks looks like
1.14 was after the flattening though, thankfully
block state component
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...
it would just have to be in nbt
hmm
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
24w14a switched to J21
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
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
I think if we can get stuff back to 1.20.4
we could go as far as registration library stuff limits us
I think
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
yeah
with blockstate components
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
erm
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
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
thats a blockstate thing
some issue with blockstate
facing in the six directions
hmm
less than 48 hours
it's usually around a week while there's a review delay (like there is rn)
well I guess it is how it is then
@dire blade is it fine if the player can only place it where it can normally be placed
more vanilla behavior
well
weak review /j
weak review
-# let's insult the review process until it accepts you /j
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
(it flashed from off to on)
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")
);
btw ill probably just do tiny changes to canPlace
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