[Google trad]
Hello everyone.
I have a block added with mcreator that has a direction. Yet I can not get this direction with this code:
if(location.getBlock().get(Keys.DIRECTION).isPresent()) {
Tool.getLogger().info("DIRECTION");
}
How should I go about it?
[FR]
Bonjour à tous.
J’ai un bloc rajouté avec mcreator qui a une direction. Pourtant je n’arrive pas a obtenir cette direction avec ce code:
if(location.getBlock().get(Keys.DIRECTION).isPresent()) {
Tool.getLogger().info("DIRECTION");
}
Comment je dois m’y prendre ?
Sponge requires block implementations to reveal the key/values available. It does not discover them automatically.
You will need to implement the necessary MixinBlock
/ IMixinBlock
methods.
See MixinBlockFurnace
as an example of a block with a direction: https://github.com/SpongePowered/SpongeCommon/blob/a9423c7ec9f2b423b52c273f7e7a23818a8f3e41/src/main/java/org/spongepowered/common/mixin/core/block/MixinBlockFurnace.java#L69
[FR
]Bonjour,
je peux avoir un exemple, j’ai pas comprit comment faire.
Actuellement j’ai juste: mod:portal[facing=north]
Merci
[Google Trad]
Hello,
I can have an example, I did not understand how to do it.
Currently I just: mod:portal [facing=north]
Thank you
EDIT:
The Keys.DIRECTION does not exist, but my block returns. then ?
Tool.getLogger().info(player.getLocation().getBlock().toContainer().toString());
[20:15:23] [Server thread/INFO] [admintool]: MemoryDataContainer{safety=ALL_DATA_CLONED, map={ContentVersion=2, BlockState=admintoolmod:portal[facing=north]}}