Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

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

Open
doublehelix457 opened this issue Oct 2, 2019 · 2 comments

Comments

@doublehelix457
Copy link

I am currently running

  • SpongeVanilla version: 1.12.2-7.1.7-RC218 (recommended/latest still?)
  • Java version: 1.8.0_222/64-bit
  • Operating System: Linux (4.4.0-89-generic/amd64)
  • Plugins: Just my test plugin

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
Copy link
Author

Update: Doesn't work using DataManipulators

@doublehelix457
Copy link
Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant