#Make custom amethyst-like crystal growth
247 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
sorry, BeJS is 1.19 only
if we had block entities in 1.18 itd be easy to do
so theres no way i can clone the amethyst class or anything?

Just because someone said it isn't possible doesn't mean it actually is. Instead they meant that no one has successfully done it yet.
Be the first!
fair enough, i dont know JS well enough for that so im looking into using the buddingcrystals mod
okay i am fully aware this syntax is wrong but would something like this work?
onEvent('server.tick', event => {
if (block == 'kubejs:budding_rose_quartz') {
if (block+1 == None) {
event.setBlock(y+1, 'biomesoplenty:small_rose_quartz_bud')
}
else if (block+1 == 'biomesoplenty:small_rose_quartz_bud') {
event.setBlock(y+1, 'biomesoplenty:medium_rose_quartz_bud')
}
else if (block+1 == 'biomesoplenty:medium_rose_quartz_bud') {
event.setBlock(y+1, 'biomesoplenty:large_rose_quartz_bud')
}
else if (block+1 == 'biomesoplenty:large_rose_quartz_bud') {
event.setBlock(y+1, 'biomesoplenty:rose_quartz_cluster')
}
}
})
oh boy

scrap that, it needs to do that for each budding rose quartz
but idk how id do that every few ticks
workin on it
btw that script has no chance of working
dont waste your time on it
ill see if i can register a new block
event.create("budding_rose_quartz")
.displayName("Budding Rose Quartz")
.material('amethyst')
.hardness(2.0)
.noDrops()
.tagBlock('forge:budding_blocks')
.tagBlock('forge:mineable/paxel')
.tagBlock('minecraft:crystal_sound_blocks')
.tagBlock('minecraft:mineable/pickaxe')
.tagBlock('tconstruct:mineable/pickadze')
thats the code im using to create the budding block if u want to do some testing
not like that
okay okay mb
thanks tho
thanks for helping with this :)
sure, no promises this will work tho
im basically recreating it with something like this
#1177396474515042314 message
hmm okay
i dont understand too much of that but from the bits i get, its almost copying and filling out a new AE2 disk
ig youd do the same for budding amethyst
try this in startup scripts
const DeferredRegister = java('dev.architectury.registry.registries.DeferredRegister');
const Registry = java('net.minecraft.core.Registry');
const Block = java('net.minecraft.world.level.block.Block');
const Item = java('net.minecraft.world.item.Item');
const BlockItem = java('net.minecraft.world.item.BlockItem');
const Material = java('net.minecraft.world.level.material.Material');
const AmethystClusterBlock = java('net.minecraft.world.level.block.AmethystClusterBlock');
const BLOCKS = DeferredRegister.create('kubejs', Registry.BLOCK_REGISTRY);
const ITEMS = DeferredRegister.create('kubejs', Registry.ITEM_REGISTRY);
// Register a new budding amethyst block called "new_budding_amethyst"
const NEW_BUDDING_AMETHYST = BLOCKS.register('new_budding_amethyst', () => {
return new AmethystClusterBlock(Block.Properties.of(Material.STONE)); // Customize properties as needed
});
// Register a corresponding block item for "new_budding_amethyst"
const NEW_BUDDING_AMETHYST_ITEM = ITEMS.register('new_budding_amethyst', () => {
return new BlockItem(NEW_BUDDING_AMETHYST.get(), new Item.Properties());
});
lol
Paste version of crash-2023-11-27_18.54.30-fml.txt from @warm depot
You can find your KubeJS startup log in /minecraft/logs/kubejs/startup.log.
If you are on 1.18 or below it will be called startup.txt.
Please send it if asked, as it contains helpful information.
Paste version of startup.txt from @warm depot
line 19 right?
try this
const DeferredRegister = java('dev.architectury.registry.registries.DeferredRegister');
const Registry = java('net.minecraft.core.Registry');
const ItemRegistry = java('net.minecraft.world.item.Item');
const BlockItemRegistry = java('net.minecraft.world.item.BlockItem');
const AmethystClusterBlock = java('net.minecraft.world.level.block.AmethystClusterBlock');
const Block = java('net.minecraft.world.level.block.Block');
const Material = java('net.minecraft.world.level.material.Material');
const ITEMS = DeferredRegister.create('kubejs', Registry.ITEM_REGISTRY);
ITEMS.register('new_budding_amethyst', () => {
return new BlockItemRegistry(Registry.BLOCK.get('kubejs:new_budding_amethyst'), new ItemRegistry.Properties());
});
squoshis better at this stuff than me tbh lol
we'll see if this works though
kk
Paste version of startup.txt from @warm depot
lol now its block redeclaration

bruh
try that ```js
const DeferredRegister = java('dev.architectury.registry.registries.DeferredRegister');
const Registry = java('net.minecraft.core.Registry');
const ItemRegistry = java('net.minecraft.world.item.Item');
const BlockItemRegistry = java('net.minecraft.world.item.BlockItem');
const AmethystClusterBlock = java('net.minecraft.world.level.block.AmethystClusterBlock');
const Material = java('net.minecraft.world.level.material.Material');
const ITEMS = DeferredRegister.create('kubejs', Registry.ITEM_REGISTRY);
ITEMS.register('new_budding_amethyst', () => {
return new BlockItemRegistry(
new AmethystClusterBlock(Block.Properties.of(Material.STONE)),
new ItemRegistry.Properties()
);
});
Paste version of startup.txt from @warm depot
ooo different error
@radiant veldt do you know if amethyst block also is a block entity?
i think it should be though re registering it should inherit the class
try that blue i edited the most recent one
if that doesnt work i got another one to try
if it is a block entity you will need lated to register this block that entity type or it won't tick
Paste version of startup.txt from @warm depot
later*
same error

i edited it again
would we do it like how reverter did that one script then or you mean we have to somehow tick it later
why are you using this instead or event.custom?
oh yeah maybe we do that then
you can use e.custom for blocks?
did the newest script work?
for any register
launching
Paste version of startup.txt from @warm depot
same again :/
use ITEMS["register(java.lang.String,java.util.function.Supplier)"]
instead of ITEMS.register
oo
like this? ```js
const DeferredRegister = java('dev.architectury.registry.registries.DeferredRegister');
const Registry = java('net.minecraft.core.Registry');
const ItemRegistry = java('net.minecraft.world.item.Item');
const BlockItemRegistry = java('net.minecraft.world.item.BlockItem');
const AmethystClusterBlock = java('net.minecraft.world.level.block.AmethystClusterBlock');
const Material = java('net.minecraft.world.level.material.Material');
const ITEMS = DeferredRegister.create('kubejs', Registry.ITEM_REGISTRY);
ITEMS["register(java.lang.String,java.util.function.Supplier)"]('new_budding_amethyst', () => {
return new BlockItemRegistry(
new AmethystClusterBlock(Block.Properties.of(Material.STONE)),
new ItemRegistry.Properties()
);
});
yes
[Quote ➤](#1058263188216479834 message) A how to and example on creating custom blocks, maybe using Chief's example.
found this
Paste version of startup.txt from @warm depot
what is with these redeclaration errors
Error loading KubeJS script: TypeError: TypeError: redeclaration of var ResourceLocation.
loll
[Quote ➤](#1058263188216479834 message) all righty thank you very much doggo and squoshi. After some headscratching I figured out how to do blockitems lol.
const $BlockProperties = java('net.minecraft.world.level.block.state.BlockBehaviour$Properties');
const $CakeBlock = java('net.minecraft.world.level.block.CakeBlock');
const $Material = java('net.minecraft.world.level.material.Material');
const $ItemProperties = java('net.minecraft.world.item.Item$Properties');
const $BlockItem = java('net.minecraft.world.item.BlockItem');
let cakeTest = Utils.getRegistry('minecraft:block').register('kubejs:cake', () => new $CakeBlock($BlockProperties.of($Material.AMETHYST)));
Utils.getRegistry('minecraft:item').register('kubejs:cake', () => new $BlockItem(cakeTest.get(), new $ItemProperties().stacksTo(64)));
This code works and registers a cake block and its BlockItem.
this looks like would work
okay im in world
on 1.18
how do i know?
i guess speed up the randomtickspeed gamerule
weird lol
oh shit do i need to change the new_budding_amethyst to my block id
that was me being dumb and leaving a redundant class in the script
yeah you can rename it whatever though im curious if itll inherit the block entity class
make sure it grows amethyst tho
if it doesn't, when you put on the world you will have a error/warn message on console saying that it can't be ticked
:c
Paste version of startup.txt from @warm depot
and there it is, uncandango calling it as per usual
: kubejs:kubejs:budding_rose_quartz
haha
nice emoji
perfect
jinxed
nah
even when you set the randomtickspeed to 1000
yea its 10000 rn
hmm
regular grows fast other one nothing
theres an error here
Paste version of startup.txt from @warm depot
latestlogs
Paste version of latest.log from @warm depot
btw theres this error in startup TypeError: Cannot find function clusterCount in object dev.latvian.mods.kubejs.level.gen.properties.AddOreProperties@7a40b362. (startup_scripts:script.js#178)
worldgen add is not related
fair
line 232 in the latest.log
line 892 but i dont think thats related
i think theres growth conditions in the block properties
i don't see anything about block entity, maybe this is not a block entity at all
okay go on
if this is all too hard i can just rename quarks red corumdum and retexture it and change the loot table
nvm
is it supposed to be BuddingAmethystBlock or what? I'm confused what we are actually trying to register
isn't the block that grow stuff?
and isn't it the Budding

hey don
o//
hello o/
good news, this is not a block entity
it just runs on random tick
pogg
okay imma go get food, if you guys get bored then dont stress it, i appreciate all the help
be back in a bit
const DeferredRegister = java('dev.architectury.registry.registries.DeferredRegister');
const Registry = java('net.minecraft.core.Registry');
const BlockItemRegistry = java('net.minecraft.world.item.BlockItem');
const BuddingAmethystBlock = java('net.minecraft.world.level.block.BuddingAmethystBlock');
const Material = java('net.minecraft.world.level.material.Material');
const ITEMS = DeferredRegister.create('kubejs', Registry.ITEM_REGISTRY);
ITEMS['register(java.lang.String,java.util.function.Supplier)']('new_budding_amethyst', () => {
return new BlockItemRegistry(
new BuddingAmethystBlock(Block.Properties.of(Material.STONE)),
new ItemRegistry.Properties()
);
});
why no $ in var names 
what is BLOCKS.new_budding_amethyst? isnt it undefined?
like that?(edited code)
??tryitandsee

well the guys gotta get back from eating first
where are you basing this on?
like the properties and stuff, will it work being copied from STONE?
im just tryna get it into the game tbh
??tryitandsee
why no dev env?
not budding block, you should see how mc already does that 
also I'm not seeing how it will grow custom clusters 🤔 what am I missing?
ngl, we should just see how AE2 does that
oh true
lmao
tried this and got into a world
but nothing is growin
hmmm
I feel like you guys are over complicating this, for the budding block you can just register a basic kubejs block and put the logic in the randomTick callback

and here i was gonna register a block entity itself ```js
const CAMPFIRE_BLOCK_ENTITY = BLOCK_ENTITIES.register('campfire_block_entity', () => {
return BlockEntityType.Builder
.create(SimpleContainerBlockEntity.prototype.constructor, BLOCKS.get('new_campfire'))
.build(null);
});
though its not really working
ill try the callback thing i guess
isn't randomTick exclusive to crop blocks?
nvm, it is the Survive callback that is exclusive to crop block
got it working, pretty much exactly replicates amethyst block
global.amethystblock = tick => {
const { block, level } = tick;
const pos = block.getPos();
const Direction = java('net.minecraft.core.Direction');
const growAmethystBuds = () => {
Direction.values().forEach(face => {
const offsetPos = pos.relative(face);
const adjacentBlockId = level.getBlock(offsetPos).id;
const chanceOfGrowth = 0.1;
const randomValue = Math.random();
const blockTypes = {
'minecraft:air': 'small_amethyst_bud',
'minecraft:small_amethyst_bud': 'medium_amethyst_bud',
'minecraft:medium_amethyst_bud': 'large_amethyst_bud',
'minecraft:large_amethyst_bud': 'amethyst_cluster',
};
const blockType = blockTypes[adjacentBlockId];
if (blockType && randomValue < chanceOfGrowth) {
const command = `setblock ${offsetPos.getX()} ${offsetPos.getY()} ${offsetPos.getZ()} minecraft:${blockType}[facing=${face}]`;
tick.server.runCommandSilent(command);
}
});
};
growAmethystBuds();
};
onEvent('block.registry', event => {
event.create('rose_quartz_budding_block')
.material('amethyst')
.hardness(0.5)
.displayName('Rose Quartz Budding Block')
.randomTick(tick => global.amethystblock(tick));
});
and before you say anything cause i know you will, yes i had to use server commands because theres no .setBlock property in level here to set the blockstate and it was either this or a bunch of reflection
this pretty much exactly replicates an amethyst block because the amethyst block also goes off the random tick callback function
which like reverter said APPARENTLY was just flat out part of kubejs block building functionality

@warm depot test the code out and let me know, since the functions in a global event you can edit anything in that global function and run /kubejs reload startup_scripts to reload it without having to do a full game restart
👏👏👏
just woke up, ill test it in a bit
man u guys are the best
and i assume i can change the crystals that grow on it?
yessir
just need to change it to whatever you need and its not limited to just the 4 entries either
??closeticket
Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue! This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.
Do you have any other questions regarding your issue? Feel free to ask!
Note: You generally should create a new post for unrelated issues.
working code, goes into startup scripts, for anyone else that finds this

