#How to make a custom block like tinted glass?
108 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
e.create('fancy_glass').defaultTranslucent()
This is mostly correct, but the block still lets light through. To clarify, I want it to act like the new tinted glass introduced in 1.17, not the coloured stained glass.
this is making me mad
declaration: package: net.minecraft.world.level.block, class: TintedGlassBlock
if you wanted to use that class exactly you'd use event.custom(id, object) in the registry event
wait wha 
public CustomBuilderObject(ResourceLocation i, T object, RegistryObjectBuilderTypes<T> registry) dis?
public CustomBuilderObject(ResourceLocation i, T object, RegistryObjectBuilderTypes<T> registry)
maybe this
public BuilderBase.CustomBuilderObject<T> custom(String id, T object)
ye
that crashed heh
oh fuck me
This is far more complicated than I thought it would be
its cuz i wrote event instead of e
give me a minute
const $TintedGlassBlock = Java.loadClass('net.minecraft.world.level.block.TintedGlassBlock')
const $Blocks = Java.loadClass('net.minecraft.world.level.block.Blocks')
const $Properties = Java.loadClass('net.minecraft.world.level.block.state.BlockBehaviour$Properties')
StartupEvents.registry('block', event => {
let customGlass = new $TintedGlassBlock($Properties.copy($Blocks.TINTED_GLASS))
event.custom('new_glass', customGlass)
})
something like that (untested)
there was an example somewhere from chief about using custom block classes when it was added as a feature to kjs6
they should be added to #1048591172165189632 and the stupid simple examples being yeeted cuz it just spams it
i'll add this once i get it working
it was before the forum switch, so probably in #archived-example-scripts
typo crash cuz Copy 
I did write the whole thing in discord without an editor lol
uhh
im experiencing something weird
the blocks dont have an item version xd
so i cant pick them up lol
well it's still expecting a texture file lol
cough
im middle clicking in creative
out, wait the loot table wouldn't be made lol
yeah you have to generate the item too
yeah i can do this
found the example I was looking for
<#archived-example-scripts message>
I got pretty close for making it up from memory
const $TintedGlassBlock = Java.loadClass('net.minecraft.world.level.block.TintedGlassBlock')
const $Blocks = Java.loadClass('net.minecraft.world.level.block.Blocks')
const $BProperties = Java.loadClass('net.minecraft.world.level.block.state.BlockBehaviour$Properties')
const $BlockItem = java('net.minecraft.world.item.BlockItem')
const $IProperties = java('net.minecraft.world.item.Item$Properties')
StartupEvents.registry('block', event => {
let customGlass = event.custom('new_glass', new $TintedGlassBlock($Properties.copy($Blocks.TINTED_GLASS)))
})
StartupEvents.registry('item', event => {
event.custom('new_glass', new $BlockItem(customGlass.get(), new $IProperties()))
})
im getting mixed things
const $TintedGlassBlock = Java.loadClass('net.minecraft.world.level.block.TintedGlassBlock')
const $Blocks = Java.loadClass('net.minecraft.world.level.block.Blocks')
const $Properties = Java.loadClass('net.minecraft.world.level.block.state.BlockBehaviour$Properties')
const BlockItem = Java.loadClass('net.minecraft.world.item.BlockItem')
const IProperties = Java.loadClass('net.minecraft.world.item.Item$Properties')
let tintedGlass
StartupEvents.registry('block', e => {
tintedGlass = e.custom('test_block', new $TintedGlassBlock($Properties.copy($Blocks.TINTED_GLASS)))
})
StartupEvents.registry('item', e => {
e.custom('test_block', new BlockItem(tintedGlass.get(), new IProperties()))
})
this is what i have, but its still not blocking light 
hmmm
boxed in ^
you'd think that would work....
also do i just append stuff to that custom like it was a normal builder 
cuz i dun wanna make model jsons and shit, id rather just append the json lol
oh
hol up
don't think so
nice
this was odd
when building the box, it didnt update the air blocks inside
i had to fill the inside and then destroy it
wtf 
i still seem to have some methods o.o
getClass, clientRegistry, wait, transformObject, translationKey, displayName, newID, notifyAll, createAdditionalObjects, notify, registryType, hashCode, get, tag, id, generateDataJsons, class, translationKeyGroup, generateAssetJsons, getTranslationKeyGroup, generateLang, createObject, addResourcePackLocations, getRegistryType, equals, toString
generateDataJsons 
nevermind
making progress but still not done
got this far, but the texture is not transparent xD
I've just written my own model json files, but I think I've got it working
I just included "render_type": "translucent" in the model file
I think this was added in 1.19
I've noticed something odd though. I'm using the vanilla tinted glass texture for the new block, but it appears to be lighter than the vanilla block
The new block is on the left and the vanilla tinted glass is on the right
Also my item model doesn't render transparent blocks behind it
But these are just minor issues
what did you do for item model?
in the json
check the post i made, see if yours is similar
I think my jsons are the same as yours
what blocks doesnt it render
more specifically what have you tried
mine renders 
I think I may have found the problem
o?
Waiting for the world to load...
It seems to be a problem with the shaders I was using
when in doubt, blame optifine/iris/oculus 😉
