#custom item spawns entity not working
87 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
its in onEvent('item.registry', event => {
you didnt give the mob a position
let entity = level.createEntity('adventurez:piglin_beast')
entity.x = x
entity.y = y
entity.z = z
entity.spawn()
as an example
Oh wow so I need to specify the position?
Didn’t think I needed too I’ll fix it tomorrow
Well it won't know where to spawn it :p
Can I just put x, y, z in?
Best case it will default to 0 0 0
So is it summoning to relative position or natural coordinates
I can check in a bit if there's other ways, but with that example you can just put your players xyz
Or any xyz that you calculate
So for example if I wanted to spawn it ten blocks above the player
I would make x 0 y 10 and z 0?
Oh I see
So entity.y = player.y + 10
Awesome thank you I will test tomorrow as I am currently in bed
Can't really check exactly, cuz I'm on phone
Same lol
But that would be the basic idea
doesnt seem to have worked
event.create('energized_orbee').maxStackSize(1).rarity('rare').glow(true) .finishUsing((itemstack, level, entity) => { let summonGhow = level.createEntity("ghastcow:ghast_cow") summonGhow.x = player.x summonGhow.y = player.y + 10 summonGhow.z = player.z summonGhow.spawn() itemstack.itemstack.shrink(1) })
player is not defined there anywhere.... use entity as that's what you're passed in the function
still not working :C
im not getting any errors thrown though
new code
`onEvent('item.registry', event => {
event.create('crystal_clump').maxStackSize(1).rarity('rare').tooltip('Oooo, Shiny!')
event.create('glow_goop').maxStackSize(3).rarity('rare').tooltip('Very Sticky!')
event.create('plate').maxStackSize(2).rarity('rare').tooltip('I wonder where this goes?')
event.create('giant_head').maxStackSize(1).rarity('rare').tooltip("WOAH, It's huge!")
event.create('udder').maxStackSize(1).rarity('rare').tooltip("Uhm")
event.create('ghast_eye').maxStackSize(4).rarity('rare')
event.create('ghasts_sadness').maxStackSize(1).rarity('rare')
event.create('orbee').maxStackSize(1).rarity('rare')
event.create('energized_orbee').maxStackSize(1).rarity('rare').glow(true)
.finishUsing((itemstack, level, entity) => {
let summonGhow = level.createEntity("ghastcow:ghast_cow")
summonGhow.x = entity.x
summonGhow.y = entity.y + 10
summonGhow.z = entity.z
summonGhow.spawn()
itemstack.itemstack.shrink(1)
})
// Register new items here
// event.create('example_item',).displayName('Example Item').maxStackSize(1)
})`
i think i forgot to specify in the code that the item is useable gimme a sec
You can write your code in a codeblock by typing it between the codeblock delimiters:
```js
onEvent('recipes', e => {
e.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
```
As an example, :arrow_up: will look like this:
onEvent('recipes', e => {
e.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
adsa ```
onEVent
i see
everything is working now just fixing a crash here is new code
onEvent('item.registry', event => {
event.create('crystal_clump').maxStackSize(1).rarity('rare').tooltip('Oooo, Shiny!')
event.create('glow_goop').maxStackSize(3).rarity('rare').tooltip('Very Sticky!')
event.create('plate').maxStackSize(2).rarity('rare').tooltip('I wonder where this goes?')
event.create('giant_head').maxStackSize(1).rarity('rare').tooltip("WOAH, It's huge!")
event.create('udder').maxStackSize(1).rarity('rare').tooltip("Uhm")
event.create('ghast_eye').maxStackSize(4).rarity('rare')
event.create('ghasts_sadness').maxStackSize(1).rarity('rare')
event.create('orbee').maxStackSize(1).rarity('rare')
event.create('energized_orbee').maxStackSize(1).rarity('rare').glow(true)
.useDuration((itemstack) => 1)
.use((level, player, hand) => true)
.finishUsing((itemstack, level, entity) => {
let summonGhow = level.createEntity("ghastcow:ghast_cow")
summonGhow.fullNBT = {Attributes: [{Base: 1d, Name: "minecraft:generic.movement_speed"}, {Base:1000d, Name: "minecraft:generic.max_health"}, {Base:10d, Name: "minecraft:generic.armor"}], HandItems: [{id: "minecraft:diamond", Count: 1b}, {}]},
summonGhow.x = entity.x,
summonGhow.y = entity.y + 10,
summonGhow.z = entity.z,
summonGhow.spawn(),
itemstack.itemStack.shrink(1)
})
// Register new items here
// event.create('example_item',).displayName('Example Item').maxStackSize(1)
})
whats the crash
Paste version of startup.txt, latest.log from @tulip magnet
what do you mean says nothing
its literally first line

missing } after property list (startup_scripts:script.js#18)
how did you miss a bracket 
yep but where is it missing
nope
vscode
what
4 errors
onEvent('item.registry', event => {
event.create('crystal_clump').maxStackSize(1).rarity('rare').tooltip('Oooo, Shiny!')
event.create('glow_goop').maxStackSize(3).rarity('rare').tooltip('Very Sticky!')
event.create('plate').maxStackSize(2).rarity('rare').tooltip('I wonder where this goes?')
event.create('giant_head').maxStackSize(1).rarity('rare').tooltip('WOAH, It\'s huge!')
event.create('udder').maxStackSize(1).rarity('rare').tooltip('Uhm')
event.create('ghast_eye').maxStackSize(4).rarity('rare')
event.create('ghasts_sadness').maxStackSize(1).rarity('rare')
event.create('orbee').maxStackSize(1).rarity('rare')
event.create('energized_orbee').maxStackSize(1).rarity('rare').glow(true)
.useDuration((itemstack) => 1)
.use((level, player, hand) => true)
.finishUsing((itemstack, level, entity) => {
let summonGhow = level.createEntity('ghastcow:ghast_cow')
summonGhow.fullNBT = { Attributes: [{ Base: '1d', Name: 'minecraft:generic.movement_speed' }, { Base: '1000d', Name: 'minecraft:generic.max_health' }, { Base: '10d', Name: 'minecraft:generic.armor' }], HandItems: [{ id: 'minecraft:diamond', Count: '1b' }, {}] },
summonGhow.x = entity.x,
summonGhow.y = entity.y + 10,
summonGhow.z = entity.z,
summonGhow.spawn(),
itemstack.itemStack.shrink(1)
})
})
bruh i forgot a ,
wha
i got rid of all the ,
im so confused
all my errors are
[{
"resource": "/D:/CurseForge/Minecraft/Instances/ShipTest/kubejs/startup_scripts/script.js",
"owner": "typescript",
"code": "1351",
"severity": 8,
"message": "An identifier or keyword cannot immediately follow a numeric literal.",
"source": "ts",
"startLineNumber": 18,
"startColumn": 47,
"endLineNumber": 18,
"endColumn": 48
},{
"resource": "/D:/CurseForge/Minecraft/Instances/ShipTest/kubejs/startup_scripts/script.js",
"owner": "typescript",
"code": "1351",
"severity": 8,
"message": "An identifier or keyword cannot immediately follow a numeric literal.",
"source": "ts",
"startLineNumber": 18,
"startColumn": 103,
"endLineNumber": 18,
"endColumn": 104
},{
"resource": "/D:/CurseForge/Minecraft/Instances/ShipTest/kubejs/startup_scripts/script.js",
"owner": "typescript",
"code": "1351",
"severity": 8,
"message": "An identifier or keyword cannot immediately follow a numeric literal.",
"source": "ts",
"startLineNumber": 18,
"startColumn": 153,
"endLineNumber": 18,
"endColumn": 154
},{
"resource": "/D:/CurseForge/Minecraft/Instances/ShipTest/kubejs/startup_scripts/script.js",
"owner": "typescript",
"code": "1351",
"severity": 8,
"message": "An identifier or keyword cannot immediately follow a numeric literal.",
"source": "ts",
"startLineNumber": 18,
"startColumn": 237,
"endLineNumber": 18,
"endColumn": 238
}]```
i cant find any errors concerning this bracket
what the hell is that 
tats the errors
given by what
that vsc
ive never seen a list like that before
ok gimme a sec
onEvent('item.registry', event => {
event.create('crystal_clump').maxStackSize(1).rarity('rare').tooltip('Oooo, Shiny!')
event.create('glow_goop').maxStackSize(3).rarity('rare').tooltip('Very Sticky!')
event.create('plate').maxStackSize(2).rarity('rare').tooltip('I wonder where this goes?')
event.create('giant_head').maxStackSize(1).rarity('rare').tooltip("WOAH, It's huge!")
event.create('udder').maxStackSize(1).rarity('rare').tooltip("Uhm")
event.create('ghast_eye').maxStackSize(4).rarity('rare')
event.create('ghasts_sadness').maxStackSize(1).rarity('rare')
event.create('orbee').maxStackSize(1).rarity('rare')
event.create('energized_orbee').maxStackSize(1).rarity('rare').glow(true)
.useDuration((itemstack) => 1)
.use((level, player, hand) => true)
.finishUsing((itemstack, level, entity) => {
let summonGhow = level.createEntity("ghastcow:ghast_cow")
summonGhow.fullNBT = {
Attributes: [{Base: 1d, Name: "minecraft:generic.movement_speed"}, {Base:1000d, Name: "minecraft:generic.max_health"}, {Base:10d, Name: "minecraft:generic.armor"}], HandItems: [{id: "minecraft:diamond", Count: 1b}, {}]
},
summonGhow.x = entity.x
summonGhow.y = entity.y + 10
summonGhow.z = entity.z
summonGhow.spawn()
itemstack.itemStack.shrink(1)
})
// Register new items here
// event.create('example_item',).displayName('Example Item').maxStackSize(1)
})
this is my current code
you didnt copy mine
no... ill check it now...
now the ghow is being summoned with 0 health etc
but the crash is fixed ty
try this
onEvent('item.registry', event => {
event.create('crystal_clump').maxStackSize(1).rarity('rare').tooltip('Oooo, Shiny!')
event.create('glow_goop').maxStackSize(3).rarity('rare').tooltip('Very Sticky!')
event.create('plate').maxStackSize(2).rarity('rare').tooltip('I wonder where this goes?')
event.create('giant_head').maxStackSize(1).rarity('rare').tooltip('WOAH, It\'s huge!')
event.create('udder').maxStackSize(1).rarity('rare').tooltip('Uhm')
event.create('ghast_eye').maxStackSize(4).rarity('rare')
event.create('ghasts_sadness').maxStackSize(1).rarity('rare')
event.create('orbee').maxStackSize(1).rarity('rare')
event.create('energized_orbee').maxStackSize(1).rarity('rare').glow(true)
.useDuration((itemstack) => 1)
.use((level, player, hand) => true)
.finishUsing((itemstack, level, entity) => {
let summonGhow = level.createEntity('ghastcow:ghast_cow')
summonGhow.fullNBT = { Attributes: [{ Base: 1, Name: 'minecraft:generic.movement_speed' }, { Base: 1000, Name: 'minecraft:generic.max_health' }, { Base: 10, Name: 'minecraft:generic.armor' }], HandItems: [{ id: 'minecraft:diamond', Count: 1 }, {}] },
summonGhow.x = entity.x,
summonGhow.y = entity.y + 10,
summonGhow.z = entity.z,
summonGhow.spawn(),
itemstack.itemStack.shrink(1)
})
})
