ChessMod

ChessMod

104k Downloads

Quantum board creation

riri404 opened this issue ยท 4 comments

commented

Now that the board is registered in 1.20, I've started the implementation of the quantum board. I am using events for the mechanism, instead of creating a recipe of two quantum boards and an enderpearl. So far, the event is set up, but I have to start the linking process. I brainstormed a little yesterday and will start probably later this week.

commented

Some issues when extending the GoldenChessBoardEntity:

  1. The super() takes fewer arguments when using the GoldenChessBoardEntity than if we extend ChessBoardEntity
  2. There is still some mirroring issues in chessPlay (the getLinkedBoards() needs to fetch the boards directly)
  3. The chess pieces do not render

Attempted solutions:

  1. Removed the blockEntityType argument to fit the GoldenChessBoardEntity constructor
  2. Will try fetching from the linkedChessboards hashMap in order for getLinkedBoards() to actually mirror
  3. I have not looked more into the rendering issue

Next steps:

  • Ask for help for the rendering issue and if removing the blockEntityType argument might cause further issues
  • Fix getLinkedBoards()
commented

For rendering, the trick is to not subclass the GoldenChessBoardEntity. We just subclass ChessBoardBlockEntity and do it the old way. We may want to introduce an interface on entities for type-management in the events, but that's a relatively benign thing to do. The blockEntityType argument is needed to have things tie together behind the scenes, I believe.

commented

Creating the following TODO

  • EnderPearlEventHandler: override the right-click event for the enderpearl. When a player right-clicks on one chessboard with an enderpearl, store the chessboard's position.
  • Linking Two Chessboards: If a player right-clicks on another chessboard with the same enderpearl (before throwing it), link the two chessboards. I will figure this out next week.
  • Synchronize Moves: When a player makes a move on one chessboard, reflect the same move on its linked chessboard.
    This can be done by sending custom packets between the client and the server(I am a networking genius now). The packet would contain info about the move (initial position, final position). When the server receives this packet, it will then update the linked board.

I will change some of these mechanism as I go. I will probably need to handle situations such as one board getting destroyed

commented

After using synchronized block + nonce + debounce logic( stolen from hardware debounce logic), the event no longer fire twice.

  • The event handler needs to be cleaned up it looks too gross to read, but hey its working
  • make the enderpearl disappear after it has been used to link, this makes sense from a survival pov