#is it possible to override a java method from a specific mod?

118 messages · Page 1 of 1 (latest)

modern parrot
#

these freaking easter eggs are annoying literally everyone on my server and they can't be disabled. i found these methods from corail tombstone, is it possible to force them to always return false?

snow oakBOT
#

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

woven sun
#

im 100% sure i remember seeing a config option for those
or like a command to disable them

modern parrot
#

oh, the april fools one aswell

modern parrot
#

TQcraft 2 days ago

I have checked every single entry of corail tombstone configs and there is no way to disable this...

I made a post on corail tombstone github for issues.

UPDATE: Dev instantly closed my post. Comment from dev: "They only spawn around players, not in all dimensions, with a timer. They have no reason to be disableable."

I guess this dev is not very intuitive about how changes are perceived by other players. How obvious is it that adding random items that get auto picked by magnets etc. around every single player would be infuriating? Easter eggs just been out a few days and already see posts about it.
``` https://www.reddit.com/r/allthemods/comments/1bk602e/easter_egg_spawn_to_much/
#

the dev's an ass

woven sun
#

They have no reason to be disableable.

modern parrot
#

ikr

woven sun
#

why wouldnt you add something so easy wtf hmmm

#

it would take at most 5 mins to implement this

modern parrot
#

by default they're literally everywhere, causing server lag, and clogging my player's inventories

woven sun
#

unless theres an event for them spawning, i dont think you can disable them with KJS currently
i think you'd need a mixin for that

modern parrot
#

no way to use reflection to overwrite the method?

woven sun
#

is this closed source?

modern parrot
#

yes...

woven sun
#

i think an easy way would be to literally make the most minimal mod that mixins into it and changes it

#

but this is pure undiluted cringe like wtf

modern parrot
woven sun
#

um

#

i dont actually know thinking_hmmm_lex

modern parrot
# woven sun but this is pure undiluted cringe like wtf

yeah,, my thoughts exactly, i encountered the easter eggs, went to look at how to disable them, found that they're not disableable, found that it's closed source, and my first reaction was "Why are pack devs still using this mod"

#

it doesn't look like there's an event for it unfortunately

#

don't ask me how i know... but they're spawned in the onPlayerUpdate event

woven sun
#

KJS can only do it if the mod is calling an event which will then spawn them

modern parrot
#

right uh,, one sec

#

yeah, doesn't look like it's calling any events, unless, is there an event for when an entity is added into the world?

woven sun
#

entity spawned event

#

and entity checkspawn just before its spawned

modern parrot
#

right, are those cancelable?

woven sun
#

yes

modern parrot
#

nice, ty

woven sun
#

lol

modern parrot
woven sun
#

its whenever a mob is added, i dunno what triggers it

modern parrot
#

how do i register an arbitrary java event in kjs?

woven sun
#

you mean register a new event, or hook into an existing one?

modern parrot
#

well, register a listener

woven sun
#
ForgeEvents.onEvent('event here', e => {})

in startup, always

modern parrot
#

okey ty

#

This event is fired whenever an Entity joins a Level. This event is fired whenever an entity is added to a level in LevelWriter.addFreshEntity(Entity) aight nice, EntityJoinLevelEvent,, how do i know if its cancellable? or,, i suppose i can just delete the item if it's the easter egg

#

oh wait it says here it is cancellable

modern parrot
woven sun
#

im not sure tbh hmmm

#

you'll have to test it thinking_hmmm_lex

modern parrot
#

in the "event here" part, does it need to be the full classpath, or just EntityJoinLevelEvent

woven sun
#

the full path

#

like net.minecraftforge.event.level.BlockEvent$EntityPlaceEvent

modern parrot
woven sun
#

wait why are you adding a forge event to an existing KJS event?

modern parrot
#

wait KJS has this event?

woven sun
#

the entity spawn event

#

or checkspawn like i said

modern parrot
#

i looked up checkSpawn, and it said it's only called on mob spawns

woven sun
#

checkspawn is before a mob spawns

#

its the event that checks if a mob can spawn, which is used to stop a mob from spawning without it showing up for a split second

modern parrot
#

i guess,, the EntityEvent.spawned event is EntityJoinLevelEvent??

#

i got confused, cos i missed the EntityEvent section in the kjs event list,, and started looking thru forge docs lmao

bold surge
#

using kubejs event

#

you may be able to destroy/discard/kill the entity

modern parrot
#

yeah

#

if you cancel the event the entity isnt spawned

#

im working on it now

woven sun
#

also shameless plug here

sinful nacelleBOT
#

You can find online JavaDocs for Forge/NeoForge and Fabric by clicking the button.
If you want to see classes added by Minecraft, choose Forge/NeoForge.

If the page doesn't load, click the "Status" button or ping @woven sun.

woven sun
#

not using lexxie.dev duck_smh_lex

modern parrot
#

welllll you only have the latest forge version for any given minecraft version,, i want specifically 47.2.0 :p

woven sun
#

nothing is different really lol

#

cuz you cant see code

#

and you should also update to the latest, if youre not on it

bold surge
modern parrot
#

47.2.0 is what ATM9 is on e_shruggies

#
EntityEvents.spawned(e => {
    let toCancel = [
        'tombstone:easter_egg' // eat shit
    ]
    if (toCancel.includes(e.entity.item.id)) {
        console.log(`prevented spawn of: ${e.entity.item.id} at ${e.entity.x}, ${e.entity.y}, ${e.entity.z}`)
        e.cancel()
    }
})
```this should handle it, testing it now
woven sun
bold surge
#

noice

woven sun
modern parrot
#

e.entity is whatever entity was spawned

#

including items

woven sun
#

i thought you wanted to see if the mob was spawned from a spawn egg

bold surge
#

he is talking about easter eggs

#

an item by corails

modern parrot
#

no, corail tombstone drops these easter eggs on the floor everywhere

#

look how frequent this shit is, there are THREE people online

#

and this doesn't need disabled.... my ass

woven sun
#

within 1:20 minutes

#

wtf

bold surge
#

people on ATM shared that you can set a chance, and make it very rare

#

on the configs

modern parrot
#

afaik, that config is in an update to the mod that ATM9 hasn't updated to yet

#

and it's still not a solution

#

it should be disabled entirely

#

oop, if a player already had an easter egg, and tries to drop it, it gets deleted haha

woven sun
modern parrot
#

can i like,,, get the source of the event or smth?

#

and not cancel it if it's an item that a player dropped

woven sun
#

maybe check the entity nbt to see if theres some info

bold surge
modern parrot
#

yeah, true

#

but im not on a fresh world

modern parrot
bold surge
#

I think owner is attached to ItemEntity when dropped, no?

#

yes

modern parrot
#
EntityEvents.spawned(e => {
    let toCancel = [
        'tombstone:easter_egg' // eat shit
    ]

    let entity = e.entity
    let item = entity.item
    let thrower = entity.nbt.Thrower

    if (thrower) {return}
    if (!item) {return}
    if (!toCancel.includes(item.id)) {return}

    //console.log(`${entity.nbt}`)
    //console.log(`prevented spawn of: ${item.id} at ${entity.x}, ${entity.y}, ${entity.z}`)
    e.cancel()
})
``` is this right? `entity.nbt.Thrower`?
#

ok yah, seems to work

#

ty guys!

snow oakBOT
#

Ticket closed!