Comments (6)
My preferred behaviour would be that Item __str__
returns the short form but the constructor could take the long or short form:
In [2]: str(Item.AIR)
Out[2]: 'air'
In [4]: Item("air")
Out[4]: <Item.AIR: 'minecraft:air'>
In [4]: Item("minecraft:air")
Out[4]: <Item.AIR: 'minecraft:air'>
(I believe all commands are OK with the short form?)
from mcipc.
Yep. Unintentionally my last change to this Enum caused an unintended change of the previous behavior.
I reverted the changes and also added regression tests.
Fixed in 19a22f9
I made str(item)
return the long form, since I think I had problems with the short form on some commands.
from mcipc.
@conqp for some reason this is still breaking the mcwb modules tests.
There is a change in behaviour which is affecting the vaildate function https://github.com/mcipc-tools/mcwb/blob/master/mcwb/functions.py#L88-L101.
When casting an array of Item to a numpy array the numpy array now ends up containing str instead of Item and this breaks the validation. Its not clear to me why this is happening.
Investigating further.
from mcipc.
downgrading mcipc and rcon does fix the issue.
from mcipc.
Well, Item
had a __str__
method before, returning the long form, so that kind of behaviour should not have changed.
However, Item
now is also a subclass of str
, which is intentional.
from mcipc.
OK the subclass of str
is probably what is doing it. numpy likes to use the base class of its elements as its type, I believe.
It also means that ndarray.toList() is returning a list of str even if you do make a numpy array of Item.
I have worked around this by supplying a dtype of Item to numpy constructors, so mcwb is working again. Now when we save an 'Items' object to a json file it now looks like a list of long form string (because it uses toList), but this works OK and is a bit more legible than the old format. loading of Items objects still supports the old and new json formats.
In short, I think the new behaviour is now fine for mcwb and mciwb. The only problem is if there are any other users relying on the old behaviour.
from mcipc.
Related Issues (20)
- use of built in types for Type hints HOT 2
- Can not install via pip "No matching distribution found for mcipc" HOT 3
- I can't run the example program HOT 4
- TypeError: cannot convert 'NoneType' object to bytes HOT 3
- Linux Bug HOT 2
- Doesn't work anymore HOT 5
- Client.stats() (as depicted in readthedocs) refuses to work HOT 2
- Converting into dict() HOT 2
- Bedrock? HOT 3
- Python 3.8 HOT 1
- is async supporting? HOT 1
- TypeError: 'TypeVar' object is not callable HOT 2
- Long responses from commands are truncated and break the connection HOT 25
- Parsing NBT HOT 2
- I'm having problems creating the code HOT 1
- ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it HOT 1
- An existing connection was forcibly closed by the remote host HOT 3
- Error while attempting to run a command using RCON on a Minecraft Bedrock Server HOT 2
- Circular import error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcipc.