SpongePowered / SpongeVanilla

The SpongeAPI implementation for Vanilla Minecraft.
http://www.spongepowered.org/
MIT License
254 stars 78 forks source link

Offering Keys.POWERED or BlockTrait BooleanTraits.LEVER_POWERED to a lever doesnt update the block the lever is on. #420

Open doublehelix457 opened 5 years ago

doublehelix457 commented 5 years ago

I am currently running

Issue Description I have attempted to change the state of a lever by trying either the methods above like so:

if(!block.supports(Keys.POWERED)) return; Sponge.getCauseStackManager().pushCause(Object); block.offer(Keys.POWERED, power); Sponge.getCauseStackManger().popCause();

and

Optional<BlockState> lever = block.getBlock().withTrait(BooleanTraits.LEVER_POWERED,power); if(lever.isPresent()) { Sponge.getCauseStackManager().pushCause(Object); block.setBlock(lever.get()); Sponge.getCauseStackManager().popCause(); }

Ive even added a scheduled update on the block the lever is on, to no avail.

The reason i say the block the lever is on is not updating is because redstone torches and lamps on the block don't update around the block the lever is on. Redstone or other blocks DIRECTLY connected to the lever work as normal. Oddly enough, i dont hear the lever flick sound effect, not sure if related.

doublehelix457 commented 5 years ago

Update: Doesn't work using DataManipulators

doublehelix457 commented 5 years ago

Update: It would appear this is actually a mojang bug related to: https://bugs.mojang.com/browse/MC-120682

I was able to work around my problem using NMS World. Set Lever blockstate, notifyNeighbors, update attached block, notifyNeighbors.

A Sponge fix would be awesome though.