#Custom Cake + TP

38 messages · Page 1 of 1 (latest)

strong smelt
#

Hello,

I'm a bit stuck with creating a custom cake and could really use some help.

I'm not sure how to make it edible, and the texture isn’t showing up correctly either. I also noticed that I can't create an item with the same name as a block.

I’m usually comfortable working with KubeJS, including custom crafting, textures, etc., but I’m struggling with this setup. Any guidance would be much appreciated!

silent badgerBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

steady wedge
#
StartupEvents.registry("block", event => {
  event.create('example_pie', 'farmersdelight:pie')
    .sliceItem('kubejs:example_pie_slice')
    .displayName('Example Pie')
  event.create('example_feast', 'farmersdelight:feast')
    .servingsAmount(3)
    .servingItems(['kubejs:example_feast_serving', 'kubejs:example_feast_serving_2'])
    .displayName('Example Feast')
})

oh how perfect they're even creating a cake as an example

strong smelt
#

Oh ! I'll try !

steady wedge
#

good luck ^^

strong smelt
#

I finally managed to get it working! The textures display correctly when the block is dropped on the ground, but they don’t appear as expected when it’s placed—I'm not sure why that’s happening, haha.

Also, is there a way to set a different texture for the block when it's in the inventory?

steady wedge
#

here is an example texturpack where they made it so blcks have a 2d image as item instead of the 3d render

#

i dont know how to exactly do it but i hope that helps you, you can also maybe look for a tutorial online

strong smelt
#

Yes i'll go check that thanks !

strong smelt
#

I managed to create a pie using the Farmer's Delight extension!

For textures, it’s essential to be very careful with the blockstates and models files! For anyone struggling with these, the "parent" line in the code is extremely important!

#

By the way, the last thing I'm trying to do is to teleport the player when they eat this pie.

The test code with the message works, but the teleport command doesn’t. Any ideas?

ItemEvents.foodEaten(event => {
// Checks if the consumed item is 'Bumble Pie Slice'
if (event.item.id == 'modycube_next_gen:bumble_pie_slice') {
event.player.tell(Text.gold('Good !!'))

    // Teleports the player to the "the_bumblezone:the_bumblezone" dimension
    event.server.runCommand(`execute in the_bumblezone:the_bumblezone run tp ${event.player.name} ~ ~ ~`)
}

})

stoic sandal
#

Utils.server

karmic wrenBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
strong smelt
#

Thanks i'll try !

steady wedge
steady wedge
#
ItemEvents.foodEaten(event => {
  const {player, server} = event;
    // Checks if the consumed item is 'Bumble Pie Slice'
    if (event.item.id == 'modycube_next_gen:bumble_pie_slice') {
        event.player.tell(Text.gold('Good !!')) 

        // Teleports the player to the "the_bumblezone:the_bumblezone" dimension
        
Utils.server.runCommandSilent(`execute as ${player.username} in the_bumblezone:the_bumblezone run tp ${player.username} ~ ~ ~`)
/*event.server.runCommand(`execute in the_bumblezone:the_bumblezone run tp ${event.player.name} ~ ~ ~`)*/
        

    }
})
#

try that

strong smelt
#

I just tried it, but nothing happens now—not even the 'Good' text.

I'm honestly quite stumped, and from here, my knowledge is limited. Thank you so much for the time you're taking to help me!

steady wedge
#

... oh thats

#

weirdd

#

what happens if you comment out everything but the event.player.tell(Text.gold('Good !!'))

steady wedge
strong smelt
#

It's Work !!!

steady wedge
#

yey ^w^

#

nice

strong smelt
#

Thank you so much. I admit I don’t fully understand the code, but I’m incredibly grateful. Thank you for everything and for your time !

steady wedge
#

if you're done with a ticket you cn type
/ticket close

but feel free to leave it open for more code questions

steady wedge
# strong smelt Thank you so much. I admit I don’t fully understand the code, but I’m incredibly...

xd ah the command i guesss you can kind of undestand

execute as ${player.username} in the_bumblezone:the_bumblezone run tp ${player.username} ~ ~ ~
run as player who ate the food in the dimension the_bumblezone and there tp the player to the position of the dimension he was in before

(noted that may lead to some not good situations like when you're in y=-60 in the overworld and the bumblezone has a world bottom limit of y=0, the player would get teleported under the bedrock and fall to their demise)

as for
const {player, server} = event;
i have to admit that i dont completely understand how it works too xd ahm but its about the same as just writing

server.player

strong smelt
#

Ok, I understand in the end xD

Thank you very much for the explanation!

And I noticed that I had appeared in blocks I will try to change it during the day

Thank you I leave the ticket open so a little time then!

steady wedge
#

alright sounds good ^w^

molten light