Compatibility with BetterSleeping
belathus opened this issue ยท 10 comments
BetterSleeping basically allows you to sleep during the day if you're tired. Any chance we can get the sleeping bag to work with that?
The problem is over here:
https://github.com/OpenMods/OpenBlocks/blob/master/src/main/java/openblocks/common/item/ItemSleepingBag.java#L149
You are using vanilla-like code which I ASMed into from my mod in vanilla, either calling vanilla method from your mod instead or adding special code for my mod would solve it, otherwise I will have to ASM into your mod and patch it like vanilla. Your choice :)
Um, yeah, I was calling vanilla method in earlier versions, but it moved player around and caused some "fall through block" problem.
I can probably stick event in there (one of allow/deny/default ones). Will this be enough?
If it will be usable in a way that I can tell OpenBlocks "yes, go ahead with sleep" or something then it should be enough :)
Well, while implementing extra event I noticed we already have this. This is Forge event. By overriding it and setting to OK
other mods can cause sleeping bag to work in every condition.
Anyway, I've decided to implement own event anyway. This should be probably more than enough.
Vanilla event wouldn't be enough as I'd return "OK" but then you'd reset it :P
Your new event should help, thanks, will add it ASAP.
(Also I've noticed that you do not have clean API, that you reference the main code from it - namely in FlimFlamRegistry, but I'll sort that out myself on my own.)
Thanks
Hmm? There shouldn't be any overwrites? If event returns something, method will exit earlier.
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, x, y, z);
MinecraftForge.EVENT_BUS.post(event);
if (event.result != null) return event.result;
Anyway, I'm going to add some other functionality to API and then release it as proper maven package. As you noticed, right now it's not very clean.
Ok, As promised:
repositories {
maven {
name "OpenMods"
url "http://repo.openmods.info/artifactory/openmods"
}
}
compile(group: 'openblocks', name: 'OpenBlocks-API', version: '1.0')
Perfect!
Will fix it from my side hopefully over the weekend :)
Thank you very much ^^