hello, i am trying to make it so nether wart cannot be placed in the overworld. natually i start by making nether wart not placeable at all, and blockevents.placed does this, but even on singleplayer the nether wart still does the placing animation, and is shown as placed very briefly.
is there a faster way to prevent the event (aka nothing happening.)
#BlockEvents.placed delay
69 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
you need to place a script in the clientscripts to prevent the block from showing up
you can place the same script you made but without any server related part
im not sure exactly which is a server-related part, but when i paste the same line into just the client_scripts folder, it doesn't seem to do anything. (added a say hi cmd to make sure it ran and it did)
i don't think the runCommand is ever gonna run, place after the =>
the say hi does execute, even when after the blockevent line
though i did notice it says server in it so peculiar but doesnt rly matter
does the block still show up?
never call server on client side or you will crash when playing on a multiplayer
does still show up briefly
like running Utils.server on *singleplayer is nono? got it
use event.player.tell("Hi") when testing
ok
not sure what you mean, i only have that single line in both the server script and client script and confirm both are running
BlockEvents.rightClicked('minecraft:soul_sand', event => event.cancel()) does make it so that blocks cannot be placed onto soul sand, however still has a visible delay where the block gets deleted
did you place one at client too?
weird... is your kubejs updated?
KubeJS uses Arch events to do that, you may want to try Forge event
ok i switched to 1.20.1 FABRIC and it actually works perfectly
i haven't heard of those, is there a place on the wiki where it goes over those because i dont see it in any events areas on the wikis
unless it isnt a kubejs thing at all
it is not, listening to forge events is too specific, let me get you an example
ForgeEvents.onEvent("net.minecraftforge.event.level.BlockEvent$EntityPlaceEvent", (event) => {
if (event.level.isClientSide()){
// Do client side stuff here
event.setCanceled(true)
} else {
// Do server side stuff here
event.setCanceled(true)
}
})
@hollow wave use this on STARTUP_SCRIPTS
after listening to this event, you may want to /probejs dump
to have auto completion
on the event
here is where you can check other stuffs about those
https://lexxie.dev/forge/1.19.2/net/minecraftforge/event/level/BlockEvent.EntityPlaceEvent.html
oh boy ok
so do i put my own lines into the if() and else() parts?
ForgeEvents.onEvent("net.minecraftforge.event.level.BlockEvent$EntityPlaceEvent", (event) => {
if (event.placedBlock.block.id == "minecraft:nether_wart"){
if (event.level.isClientSide()){
// Do client side stuff here
event.setCanceled(true)
} else {
// Do server side stuff here
event.setCanceled(true)
}
}
})
yes, and put over the IF if what you do is common to client
launching my instance to test too
rip, didn't work 😐
the last one you posted does cancel it but not any quicker than just putting in server script oof
but you must be right about something on forgeside because fabric isnt having an issue
or maybe it's 1.19.2 so i will try on forge 1.20.1 real quick
yeah and 1.20.1 is the same deal so i would assume this is just some kind of oversight but idhk cuz that link you sent makes my head spin
appreciate you giving it a try 👍
I'm trying other event that triggers on both
yes, it worked, now i'm going back to normal kubejs and see if I can not use forge event
madman
BlockEvents.rightClicked("minecraft:soul_sand", event => {
console.log("Soul Sand Right Clicked - Server")
if (event.player.getHeldItem(event.hand).id == "minecraft:nether_wart"){
console.log("Click cancelled - Server")
event.cancel()
}
})
this works perfectly, just do at server and client scripts
no need for ForgeEvent stuff
remember that this does not prevent players from using Create Deployer or other ways to plant nether wart
yeah after all this it might be a better idea to just prevent it from growing which i think there are events for, or i can replace a grown version with a non-grown version or something idk but regardless
so not to continue to bother you but why does this work, but not the other stuff
is this just a way of getting around blockevents.placed which doesnt register on client for some odd reason?
placed event only triggers on server side, that is why it flickers
cool alright then thank you sir
i imagine they want it to be clientside too so it's probably just a bug
yeah fabric it does work so tis just buggy