#I wanna restrict items in my server
165 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
we're gonna need a better explaination than that, what do you want to restrict? how do you plan on unlocking the restricted item?
I want to make these items uncraftable
and
its two items from
irons spellbooks mods
actually its a couple other items but at the bare minimum two
i see
ill tell you right now that theres a better way of restricting iron n spellbooks scrolls and books than prevent crafting(not sure if its even possible to restrict crafting of them) and that is with nbt
luckily i recently worked with someone on a script to do exactly this, sec
the real question is what is going to unlock them?
I was gonna restrict them like peramently because I wanna make them sorta dev items
since they kinda
ohhhh
unbalanace the combat
uhhhhhhhhhhhhhhhhhhhhhhhhh... im not sure im all very new to kubejs
I know the exact items
go for it
it says the level and element on the scroll/book
unless they arent spells youre trying to lock?
Nah i w as tryna lock the arcane anvil from being crafted inscription table from being crafted and the scroll forge from being crafted
is that harder?
ooooh
yeah cuz tbh theres alto f spells that work and dont work and i was like if i just restrict people from being able to do anything besides randomly find them then it restricts them enough
so all of them are just one time use
Paste version of removerecipe.js from @leaden whale
this is an example script where you can remove items by name
in the example it removes bonemeal recipe ids but you can delete those
youll want to follow the format though, this goes in kubejs>server_scripts folder
you would put the 'modid:itemname' in the output brackets
does it make them uncraftable or just like remove them entirely?
like so js [ 'minecraft:diamond', 'minecraft:gold_ingot' ].forEach((itemID) => event.remove({output: itemID}));
removes the recipe entirely
which is the same thing
bet but i can still get them thru creative or give right?
yep
okay so let me get the specifc item ids real fast and you tell me if im like
putting this in right
kk
thank you so far tho btw i was frustrated tryna solve this
np lol
if you get any errors then post your server scripts found in logs>kubejs>server_scripts
irons_spellbooks:arcane_anvil irons_spellbooks:inscription_table irons_spellbooks:scroll_forge
ok so
these are the item like scripts i have to add right?
You can write your code in a codeblock by typing it between the codeblock delimiters:
```js :arrow_left:
ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
``` :arrow_left:
As an example, :arrow_up: will look like this:
ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

irons_spellbooks:arcane_anvil irons_spellbooks:inscription_table irons_spellbooks:scroll_forge```
wheres the rest of the script?
oh my bad i was just saying is this the format to list the items
[
'irons_spellbooks:arcane_anvil,
'irons_spellbooks:inscription_table
irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID})); so like this
close
[
'irons_spellbooks:arcane_anvil',
'irons_spellbooks:inscription_table',
'irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID})); ```
they need '' around them
as well as a comma after the '
so thats it?
well you need the other part of the script but yeah
so itd be like ```js
ServerEvents.recipes(event => {
//Remove by recipe ID
[
].forEach((recipeID) => event.remove({id: recipeID}));
//Remove all recipes an item is related to. For example putting 'minecraft:bonemeal' here would remove the recipe for bone blocks as well.
[
].forEach((ingredientID) => event.remove({input: ingredientID}));
//Remove by item ID
[
'irons_spellbooks:arcane_anvil',
'irons_spellbooks:inscription_table',
'irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID}));
})```
ServerEvents.recipes(event => {
//Remove by recipe ID
[
'minecraft:bone_meal',
'ars_nouveau:horn_to_bonemeal'
].forEach((recipeID) => event.remove({id: recipeID}));
//Remove all recipes an item is related to. For example putting 'minecraft:bonemeal' here would remove the recipe for bone blocks as well.
[
].forEach((ingredientID) => event.remove({input: ingredientID}));
//Remove by item ID
[
'irons_spellbooks:arcane_anvil',
'irons_spellbooks:inscription_table',
'irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID}));
}) so this in a scrit would restrict the items?
script*
and that would be a .js file in the kubejs>server_scripts folder
do something for me
type this
111js
code111
111js
code111
just once is fine
111js
code111
ok now replace the 1s with `
111 code111 111
code111
close
just once is fine
like '''js
code''' but with ` instead of '
dont type the 1s
replace them
like type 3 `
3 `
no no
3`
3 of `
Oh like this
close
js wa js
like js test
now replace that with this ```js
ServerEvents.recipes(event => {
//Remove by recipe ID
[
'minecraft:bone_meal',
'ars_nouveau:horn_to_bonemeal'
].forEach((recipeID) => event.remove({id: recipeID}));
//Remove all recipes an item is related to. For example putting 'minecraft:bonemeal' here would remove the recipe for bone blocks as well.
[
].forEach((ingredientID) => event.remove({input: ingredientID}));
//Remove by item ID
[
'irons_spellbooks:arcane_anvil',
'irons_spellbooks:inscription_table',
'irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID}));
})```
//Remove by recipe ID
[
'minecraft:bone_meal',
'ars_nouveau:horn_to_bonemeal'
].forEach((recipeID) => event.remove({id: recipeID}));
//Remove all recipes an item is related to. For example putting 'minecraft:bonemeal' here would remove the recipe for bone blocks as well.
[
].forEach((ingredientID) => event.remove({input: ingredientID}));
//Remove by item ID
[
'irons_spellbooks:arcane_anvil',
'irons_spellbooks:inscription_table',
'irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID}));
})```
ooooooh
You can write your code in a codeblock by typing it between the codeblock delimiters:
```js :arrow_left:
ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
``` :arrow_left:
As an example, :arrow_up: will look like this:
ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
ServerEvents.recipes(event => {
//Remove by recipe ID
[
'minecraft:bone_meal',
'ars_nouveau:horn_to_bonemeal'
].forEach((recipeID) => event.remove({id: recipeID}));
//Remove all recipes an item is related to. For example putting 'minecraft:bonemeal' here would remove the recipe for bone blocks as well.
[
].forEach((ingredientID) => event.remove({input: ingredientID}));
//Remove by item ID
[
'irons_spellbooks:arcane_anvil',
'irons_spellbooks:inscription_table',
'irons_spellbooks:scroll_forge'
].forEach((itemID) => event.remove({output: itemID}));
})```
my man is enlightened
LOL i was like hold onl...
its just a lot easier to read for future tickets XD
well anyways lemme know if that script works
??tryitandsee
yeah just stick it in the kubejs>server_scripts folder
LOL my bad so should I put it in a notepad?
as a .js file
got u
yup
thanks so much man
i recommend downloading visual studio code, it makes code look like the '''js and its super helpful
np man gl with your pack
i put this in startup and server
Paste version of Restrict.js from @strong mauve
it didnt work
oh wait
BRUH
ididnt save it
i just solved my own issue
and thanks i did
wym
doing /reload?
/reload reloads the game files, its needed if you ever edit recipe events in-game
for changes to take effect anyways
pretty much just reloads kubejs scripts
server script
console.info('Hello, World! (Loaded server scripts)```
if youre ever curious which events go where theres a list of all events on the wiki page
??kjswiki
You can add, remove, and modify recipes with KubeJS. The wiki has a page on that!
If you want to learn how to add recipes to any mod, click the Custom button.
wait wrong one
This is a list of all events. It's possible that not all events are listed here, but this list will...
full list of all the events and it tells you which script folder to put them in
works perfect.
I might be back later to keep learning scripting thanks so much man made my day
Please close your ticket (with /ticket close 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.
??closeticket
Please close your ticket (with /ticket close 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.
that formatting 