Can’t seem to find anything expected browsing the javadocs…
Is this something that is going to be buried 3 or 4 levels deep in the data api, or am I overlooking a simple function on the wrong object?
Same question for the old bukkit check like isLiquid() to return if the block is solid or water/lava,is there a simple test or is it all deep in the data api as well?
All the block properties were refactored out to actual Properties and they are all implemented as expected, rather, I believe I implemented them all correctly.
So, what you can do is the following:
final Optional<LightEmissionProperty> optional = location.getProperty(LightEmissionProperty.class);
if (optional.isPresent()) {
int emittedLight = optional.get().getValue();
// do stuff with emmittedLight
}
Alright, thats a fair bit better than it could have been. I’ll fiddle with the other properties as well using your code, @gabizou and give them all a spin to see how they handle and test your belief system
LightEmissionProperty works to evaluate if a block emits light or not - glowstone and sea-lanterns return 15, all others 0 … seems fine.
SkyLuminanceProperty is 0.0 at all times - I could not get it to change its value day/night, exposed or buried where testing locations. What exactly SHOULD this one be returning, as a true measure of what?
GroundLuminanceProperty is 0.0 at all times except if testing a sealantern/torch/glowstone block. Day/night, block right beside a light source, etc - always 0.0 if not the actual lit block.
It would seem something isn’t quite right for at least one of those properties. I see no other property lists that should be reporting a spectrum of values indicating how near or far to a light source the block is, or if the block is exposed to “skylight” or shaded
CORRECTIONS after Followup Testing, for anyone search-hitting this same issue:
The GroundIllumination does work (Dev-707 testing) by reporting the light level in the volume, not for which the block is exposed. IE: The block in the ground beside a lantern/lamp/torch has ground-illumination level of 0, while the volume the player stands in above those blocks will have illumination levels of 13-14.
Even if the ground is hollowed out between the lamp and a test block, the ground test block still reports 0.0, while after digging out the block, the volume of space now has a level of 10-12 for example. Unless the groundblock is something like glass, then it reports a nonzero
So this may very well be the Intentional results for this function, the light reaching “inside” the middle of of a solid block is 0, otherwise, the light inside the middle of the volume based on its transparancy/airness is able to be appreciated.
Ground-illumination of lanterns and torch blocks also is the max level for each.
@gabizou, MatterProperty not implements?
Code: String property = block.getProperty(MatterProperty.class).get().getValue().name();
He returns:
[spoiler]```
[13:25:03] [Server thread/ERROR] [Sponge/]: Could not pass InteractBlockEvent$Secondary$Impl to SpongePlugin:Grave{dev}
java.lang.AbstractMethodError: Method net/minecraft/block/state/BlockState$StateImplementation.getProperty(Ljava/lang/Class;)Ljava/util/Optional; is abstract
at net.minecraft.block.state.BlockState$StateImplementation.getProperty(BlockState.java) ~[beg.class:?]
at io.github.azatik.grave.events.EventInteractSolidBlock.onPlayerInteractBlock(EventInteractSolidBlock.java:29) ~[EventInteractSolidBlock.class:?]
at org.spongepowered.common.event.listener.SecondaryListener_EventInteractSolidBlock_onPlayerInteractBlock25.handle(Unknown Source) ~[?:?]
at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:92) ~[RegisteredListener.class:1.8-1568-2.1-DEV-833]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:225) [SpongeModEventManager.class:1.8-1568-2.1-DEV-833]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:186) [SpongeModEventManager.class:1.8-1568-2.1-DEV-833]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:265) [SpongeModEventManager.class:1.8-1568-2.1-DEV-833]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:237) [SpongeModEventManager.class:1.8-1568-2.1-DEV-833]
at org.spongepowered.common.Sponge.postEvent(Sponge.java:104) [Sponge.class:1.8-1568-2.1-DEV-833]
at net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(ForgeEventFactory.java:66) [ForgeEventFactory.class:?]
at net.minecraft.server.management.ItemInWorldManager.func_180236_a(ItemInWorldManager.java:410) [qx.class:?]
at net.minecraft.network.NetHandlerPlayServer.onActivateBlockOrUseItem(NetHandlerPlayServer.java:440) [rj.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147346_a(NetHandlerPlayServer.java:595) [rj.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_180769_a(SourceFile:59) [mx.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:10) [mx.class:?]
at net.minecraft.network.PacketThreadUtil$1.onProcessPacket(SourceFile:63) [ih.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [ih.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_66]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_66]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) [FMLCommonHandler.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:656) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:364) [po.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:598) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_66]