Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I broke a flower and then tried to place it back #104

Open
BenMaydan opened this issue May 29, 2019 · 1 comment
Open

I broke a flower and then tried to place it back #104

BenMaydan opened this issue May 29, 2019 · 1 comment

Comments

@BenMaydan
Copy link

Exception happened during processing of request from ('192.168.0.226', 55775)
Traceback (most recent call last):
File "C:\Users\mayda\AppData\Local\Programs\Python\Python37-32\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\mayda\AppData\Local\Programs\Python\Python37-32\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\mayda\AppData\Local\Programs\Python\Python37-32\lib\socketserver.py", line 720, in init
self.handle()
File "server.py", line 55, in handle
self.loop()
File "server.py", line 100, in loop
world.remove_block(struct.unpack("iii", positionbytes), sync=False)
File "C:\Users\mayda\Desktop\Coding Class\Minecraft\world_server.py", line 96, in remove_block
del self[position]
File "C:\Users\mayda\Desktop\Coding Class\Minecraft\world_server.py", line 61, in delitem
super(WorldServer, self).delitem(position)
KeyError: (79, 62, 232)

@r58Playz
Copy link

r58Playz commented Jun 10, 2019

Just change the code near line 100 to this:

                    try:
                        world.remove_block(struct.unpack("iii", positionbytes), sync=False)
                    except KeyError:
                        warn("Cannot remove block!")

And change the imports to this:

from _socket import SHUT_RDWR
import socket
import struct
import time
import timer
import socketserver
import threading

import globals as G
from custom_types import fVector, iVector
from savingsystem import save_sector_to_bytes, save_blocks, save_world, load_player, save_player
from world_server import WorldServer
import blocks
from text_commands import CommandParser, COMMAND_HANDLED, CommandException, COMMAND_ERROR_COLOR
from utils import sectorize, make_string_packet
from mod import load_modules
from warnings import warn

This will just show an warning. The error is most likely because the game was laggy( probably you played on Singleplayer) and you tried to remove the flower twice. This results in an KeyError, because the block was removed from the index and you are trying to remove it again.

EDIT: Specify where the change is.

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

No branches or pull requests

2 participants