Code Monkey home page Code Monkey logo

Comments (9)

Karltroid avatar Karltroid commented on June 14, 2024

image
I don't know if this stems from the same issue or bedrock just handles blockstates differently, but it seems to ignore me setting stair nbt to straight instead of corner as well.

Difference with the stairs in particular is that reloading chunks doesn't fix the issue

from geyser.

Karltroid avatar Karltroid commented on June 14, 2024

image
Here is proof showing the shulker facing block state fixes after reloading the chunk

from geyser.

Camotoy avatar Camotoy commented on June 14, 2024

Please update to the latest version (and install ViaVersion as well) and re-test this and provide a Geyser dump. Thanks!

from geyser.

Karltroid avatar Karltroid commented on June 14, 2024

https://dump.geysermc.org/CAVfs9mo8A92a7vJASKQdDRKsu7C9FSi

Paper: 1.20.4 # 496
Geyser: 2.3.0
ViaVersion: 4.10.0

Same issue persists after updating everything

from geyser.

Karltroid avatar Karltroid commented on June 14, 2024

For context, this is the code on my spigot plugin that is setting the block state of the shulker

private void convertToFatChest(Block block, Material fatChestType, BlockFace facing)
{
    if (!(block.getState() instanceof Container)) return;

    // save pre conversion container
    ItemStack[] containerContents = ((Container) block.getState()).getInventory().getContents();

    // convert container to desired chest type
    BlockData newFatChest = fatChestType.createBlockData();
    ((Directional) newFatChest).setFacing(facing);
    block.setBlockData(newFatChest);

    // load pre conversion container to new container
    ((Container) block.getState()).getInventory().setContents(containerContents);
}

from geyser.

valaphee avatar valaphee commented on June 14, 2024

When do you change the block state? As Vanilla always sends the block state on placing and interacting, and when you modify it there it might send two block state updates.

from geyser.

Karltroid avatar Karltroid commented on June 14, 2024

When do you change the block state? As Vanilla always sends the block state on placing and interacting, and when you modify it there it might send two block state updates.

@EventHandler
public void onChestPlace(BlockPlaceEvent event) {

  // get if block representing a chest was placed
  Block placedBlock = event.getBlockPlaced();
  if (!placedBlock.getType().equals(GUI_CHEST)) return;
  
  // can't place chest in the middle of two chests
  List<Block> adjacentChests = getAdjacentChests(placedBlock);
  if (adjacentChests.size() > 1) {
	  event.setCancelled(true);
	  return;
  }
  
  // can't place adjacent chest next to double chest, if normal chest then create double chest!
  for (Block chest : adjacentChests) {
	  Material adjacentType = chest.getType();
	  if (isDoubleChest(adjacentType)) {
		  event.setCancelled(true);
		  return;
	  } else if (isSingleChest(adjacentType)) {
		  convertToDoubleChest(placedBlock, chest);
		  return;
	  }
  }
  
  // not a double chest, make a single chest!
  if (adjacentChests.isEmpty()) convertToFatChest(placedBlock, SINGLE_CHEST);
}

I am setting the placed block's block data right on BlockPlaceEvent

from geyser.

Karltroid avatar Karltroid commented on June 14, 2024
// not a double chest, make a single chest!
if (adjacentChests.isEmpty())
{
	convertToFatChest(placedBlock, SINGLE_CHEST);
	placedBlock.getState().update(true, true);
}

So by adding the forced state update it halfway fixes it. The fake chest is still facing upwards (default shulker state) but with the forced update it will correct its orientation when opened. So whatever is happening when the player opens the shulker needs to somehow be done on state update.

from geyser.

Karltroid avatar Karltroid commented on June 14, 2024
2024-05-14.23-53-42.mp4

Heres a video of what I mean in my previous comment

from geyser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.