#Data Maps
1224 messages · Page 2 of 2 (latest)
Conflicts
This one begs the question: do we care enough about values higher than max short with vanilla clients to have the furnace patch or do we just say fuck it, it's visual only (AFAICT the result should only be that the flame stays full until the remaining duration falls below max short) and rely on https://github.com/neoforged/NeoForge/pull/599 to fix the short limit on NF<->NF connections?
vanilla not handling it isn't our problem™️
Its the burden of the server owner if they want to make >short max burn times while accepting vanilla clients
imo that will literally never happen anyway
In the end, the info shown to a vanilla user for burn times higher than max short isn't necessarily wrong, the flame just stays full until the remaining time drops below max short
(Though, please test that assumption)
the litduration is also a short
Yes, so you have two values stuck at max short, whose division will result in 1 and therefore a full flame (purely from a logical code analysis). Once the remaining time falls below max short, the flame starts dropping as expected again.
iirc in principle specific values for burn times can cause a division by zero
if we cap to max short that's one thing, but aiui the vanilla code just does a bit truncation
@frosty token did you test the part data map or is it just a code review and I should test it before merging it later
I didn't test it, I did a pure code review
Okay
well time for me to move mek additions over to it and test and then merge it
once I muted hostile mob sounds so I could try and listen for the imitate sounds without being hard for me to tell what was real vs what was an imitation it seems to work well. 
how do data maps handle vanilla server and neoforge client again?
it doesn't. these values we have been replacing are all server sided
or rather, used by vanilla only on the server
they're optionally synced for other mods like recipe viewers or whatever
what about the FurnaceFuelSlot used by the furnace menu?
I don't think the client checks any fuels, when I tested the short stuff I used a vanilla client with a neo server that added 38k to anvils
doesn't the adjustment in the PR made fix that or am I reading the math wrong? (Or are you talking about if we just let it go past without patching that given for neo to neo it would work thanks to the full range int dataslot change)
maty, tech means neo client on vanilla server
because if the backing map is empty for what is considered a fuel
then it may not let you place it in there
re read what I said 
Is there a TODO for converting data maps
if a vanilla client doesn't check it, neither will a neo client
isFuel is net.neoforged.neoforge.common.CommonHooks.getBurnTime(p_38989_, this.recipeType) > 0;
Which means tech is likely right that if the datamap isn't read (due to the VANILLA_BURNS no longer being a thing) then it will probably return false for that when neo client on vanilla server
The latter. If it's not totally broken, then we don't really need that patch
I suppose, though it also isn't that bad a patch to make it support it correctly instead of being just partially wrong
that's not chcked directly on the client
tis the 5th time i test neo&vanilla, i'm getting tired of retesting my tests 
even if you shift click?
what is the point of having these functions if vanilla doesn't even check them 
the server seems to be the one that rejects the fuels
since like, i still can't shift click a random item nor put it there manually

may place looks to be used by the container screen for dragging an item into multiple slots
and that is the only screen based usage I see
granted why you would be dragging to split between stacks with a furance, especially when one of the slots you want to target is the fuel slot... I have no idea
so half assed
yep, everything else is handled by doClick/quickMoveStack on the server
this is the only use in vanilla that would be on the client
personally I don't think it is necessarily worth the effort to handle that one case for neo client connected to a vanilla server as I have no idea why someone would ever use that functionality for a furnace... Though I definitely think it is worth a note somewhere about that specific scenario
though inventory sorting mods might be using it as well
so if they are client side only then who knows how it would work with furnaces
i mean until today i didn't even realise you can use dragging in furnace slots
lol
but a sorting mod shouldn't put fuels into the furnace when sorting, that's bad™️
it's randomly burning user resources
1+1=2?
whether one may care
I don't know why they would but 
but yeah I don't really care too much as long as you say put a note in the javadoc for the burn data map
also since when are full slots yellow after dragging
idk, seems like we might have problems with other potential data maps?
same problem as fallback tags I would say
which problem
with a fallback tag possible desyncs would be extremely obvious and annoying, but in this case a desync would affect one particular obscure feature
(that is, dragging fuel into a furnace slot)
i dunno h ow to handle this, but i think this corner case is very stupid and doesn't matter
🤷♂️
I don't think it matters beyond making a note about in the javadocs for the datamap type. And other than that say introducing fallback datamaps is semi out of scope of this particular PR
I don't really care as long as we have decent vanilla client or server compat
yeah it is such an obscure usage that breaks I don't think anyone will actually notice the difference
so maty, amend the javadoc to note about the corner case that is known to not work when connecting to a vanilla client, and fix merge conflicts and I will approve and merge it
done
shipped
gui click/quickmove run on both sides, that's why plugin-style chest guis are such a pain in the ass to implement
server syncs back, but it won't undo if the client thinks an item got quickmoved into a slot that didn't get touched on the server
it mainly becomes a problem in this case if someone wants to disable an item that is valid vanilla fuel, though.
[er, for vanilla client / neo server, anyway]
I mean we'll support vanilla on the other side to a limited extent usually
check the pins
@sleek cliff I can't seem to access the builtinRegistryHolder for VillagerProfession. mind helping?
Ask in #modder-1․20․1-support
this is for implementing a data map, i think posting it here makes sense
@sleek cliff do you want me to hit you with the typos on the docs PR? 😛
yes
I can't seem to access the builtinRegistryHolder for VillagerProfession. mind helping?
mind helping me with this (if you have time ofc)
{
"values": {
"minecraft:acacia_fence_gate": {
"axe_strip": {
"type": "idd:combined",
"modifications": [
{
"type": "idd:state_matches",
"predicate": {
"open": "true"
},
"transformation": {
"type": "idd:constant",
"value": {
"Name": "minecraft:iron_block"
}
}
},
{
"type": "idd:constant",
"value": {
"Name": "minecraft:dirt"
}
}
]
},
"till": {
"type": "idd:constant",
"value": {
"Name": "minecraft:birch_fence_gate",
"Properties": {
"facing": "north",
"in_wall": "false",
"open": "true",
"powered": "false"
}
}
}
}
}
}
mhh
some experimenting with data maps in one of my mods
previous code was ret == -1 ? VANILLA_BURNS.getOrDefault(item, 0) : ret
Because that's correct?
0 is for unburnable
We use -1 as an intermediary value from our extension to fall back to the vanilla handling
0 is correct, -1 is only the return value from IItemExtension#getBurnTime to indicate that it should defer to vanilla logic
what ater said
right..., except now you get two different values for the exact same functionality depending on which method you're needing to use to retrieve burn time
you should never use the itemstack method
then deprecate it for removal
yeah it is pretty stupid that there is a CommonHooks method when it could just be in the itemstack method I suppose
idk man
all I'm saying is
we now have two access points
which return two different values for the same thing
that's not great from an API standpoint
even worse, the itemstack method will not call the event and is therefore incorrect
? This is the same as any of many of our other hooks declared on the extension, some of them are their to be overridden, not called.
the Item method should be overridden
but since ItemStack is final there is no reason not to put all the logic there
^
if I didn't coincidentally stumble on the commonhooks method while looking at the datamap, I wouldn't have ever known it existed
and would've used the itemstack method
Oh ItemStack, https://github.com/neoforged/NeoForge/blob/1.20.x/src/main/java/net/neoforged/neoforge/common/extensions/IItemStackExtension.java#L77 I was looking at Item.
Yeah that's not nice
PR for this at: https://github.com/neoforged/NeoForge/pull/633
#neoforge message datamap, anyone? /s
[Jump to referenced message](#neoforge message) in #neoforge
Any updates on this? In my mods, I've always AT'd the field and replaced it with a copy containing my added values.
Last I saw orion was blocking it because they know the use case of modders better than the modders themselves who are requesting it
Forge flashbacks anyone
Well the good thing is we don't need orion's approvals for things :p
Funny you say that
Because its seemingly his feedback that prevented that pr from gaining any traction
is there a pr for it?
Like I’d waste my time doing a pr when I know that’s the nonsense I’d get
The rest of us have the authority to merge, and imo you have mine and tech's approval there
I would prefer it be controlled enough (like more sophisticated than just a public mutable set)
I don’t disagree
A datamap might actually be a good target
Maybe
Actually type safety would probably pose an issue there
Plus you have to handle merging
Yeah
which tends to be a pita
data maps can handle merging
but not sure if a data map that can be configured by users is a good idea 
Yeah not for this one
Generally speaking we have been pushing for event based registration of auxiliary data
The main issue with an event here is
But thinking about that event name sounds horrible lmao
RegisterExtraBlockEntityBlocksEvent 
Itd also be a completely unnecessary additional split of registration functionality
auxiliary data to what 
Like all the client maps
You’re doing this to register your block, then you’d have to either store that in a map/list or manually write out each one to send to the event at event time
As opposed to just method calling the adder when you register your block or whatevrr
Well this is only for external modifiers
The BEType's owner wouldn't go through this process
Yeah that’s what I’m referring to
initialiseclient moment
Its probably a trivial amount of boilerplate
Not like someone is going to be adding that many blocks to external BE's
signs are pretty popular tbf
I sadly cant come up with anything better lol
Just make it a static method on BE that idk, locks after registration phase or smth
I said I don't think making it arbitrarily mutable is a good idea. Data maps or an event seem reasonable
i've been pushing for an event because it's an immutable map and even if we make it mutable cross-loader mods may replace it with an immutable map
er, set
and the fact that it is an immutable set means that allowing multiple mods to add to the same one would benefit from a gather phase rather than having each operation copy the set
Event is consistent with the existing stuff too so yeah
but that event name will just be so bad lmao
BlockEntityTypeValidBlocksEvent

For it to be findable we should prefix it with register
BlockEntityTypeEvent.ValidBlocks [do we have other BlockEntityTypeEvents? not yet]
i disagree
BlockEntityType#registerAdditionalBlock as an instance method should be fine™️
DataMapsEvent with generics /jk
No this invites all kinds of nasty things.
it invites nothing more than the event
RegisterBlockEntityTypeValidBlocksEvent
An event is much more structured and in line with systems
WaxedLightlyWeatheredCutCopperStairsEvent
it only leaves open whatever questions you decide to leave open
Yes so?
We are moving away from arbitrary registration methods and maps. Precisely because they invite threading issues and problems with registration timings. I see no reason to change that here.
they only invite threading issues because for some reason people were allergic to making synchronized registration methods
Yes. Because they put performance of boot up time in the bin
ok so what is the timing
if we can say "this is only valid during commonsetup" surely we can say "this is only valid during the enqueued work phase of commonsetup"
Was that boot time thing ever a concern? Pretty sure model load and voxel shape init still dominate boot time
like so much so that this is a non-issue
the problem was people just not using enqueue
is there a way to specify an item as a recipe ingredient ? only allow items that have a specific piece of data attached to it
or should I use them in combination with tags
are you talking about data maps or data attachments?
datamaps
You should probably use a tag for recipe inputs
the docs mention "map-based datamaps" and "collection-based datamaps". is there an example for those ?
collection based?
look at the advanced data map type
check the tests mods too
tests are great examples!
datamaps are applied to registryholders right ? so in cases of Items, they will only work with specific Items or would they also work with Tags ?
I want to apply some default value to a Tag which then I can override per Item (which has the tag)
.add(ItemTags.LOGS, new SomeObject(156, "some other string"), false)
it does work! Great!
@sleek cliff can I DM you regarding a certain implementation that I want to make using Datamaps ?
I would have but I dont think that is gonna work. It needs a bit of info dump from my side to explain what I want to do but that might just get lost in chat
I will still put a message there just incase #modder-1․20․1-support message
How expensive are getData() calls ? does it have any innate caching system ?
getData is a map lookup
O(1) on the general case
O(log n) worst case (the worst case is unlikely to happen)
I just realized this is the development discussion thread. Please stop asking in this thread, it's not for support questions
okay
it's 2 identity map lookups
