Forums - Open Redstone Engineers
MCsim (pre-alpha release) - Printable Version

+- Forums - Open Redstone Engineers (https://forum.openredstone.org)
+-- Forum: Off-Topic (https://forum.openredstone.org/forum-4.html)
+--- Forum: Programming (https://forum.openredstone.org/forum-8.html)
+--- Thread: MCsim (pre-alpha release) (/thread-1606.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


RE: Redstone lab (Open source) - CX gamer - 10-28-2014

Just made it compatible with MCedit 1.1.1 which now stores TileTicks in its schematics. This means things like clocks will resume after loading a schematic from MCedit.

Edit: Quickly added a nbt viewer:

[Image: AFHJOmA.png]


RE: Redstone lab (Open source) - CX gamer - 11-14-2014

I just broke the functionality of my previous post. No idea where or how, but nothing simulates anymore. Even though everything else seems to work as time moves forward, nothing updates anymore. >.< Been searching for a while now, must be something obvious.


RE: Redstone lab (Open source) - Chibill - 11-15-2014

There might be a change in how updates work in 1.8 I think. (Right you updated?) I have not dug in to 1.8 code much so I could not tell you.


RE: Redstone lab (Open source) - CX gamer - 11-21-2014

Oh I solved it now, had no internet during the fix so didn't update my post. In the end, it seems I have changed a method without thinking twice over it. I was first only setting worldTime, but now also totalTime. So all is fine. Big Grin

I don't think much changed on the updating itself, but rather the naming. Now it's not the block id stored in TileTick, but a string pointing to the block.


RE: Redstone lab (Open source) - Chibill - 11-22-2014

And no metadata a new fancy block state system.


RE: Redstone lab (Open source) - CX gamer - 11-26-2014

Metadata is still being used to save and load to and from schematics, it still works that way. Just also discovered that I may use cycleProperty to rotate things instead of trying to do it manually with block data.

I'm now on the way to fix right clicking on buttons, levers, .. I need to get the property "facing". The problem now is that it uses the IProperty's hashCode rather than just the name.

Code:
The IProperty we wish to obtain:
-1224145743 PropertyDirection{name=facing, clazz=class ej, values=[down, up, north, south, west, east]}
BlockLever's property and its value that we need:
-1329114687 PropertyEnum{name=facing, clazz=class axk, values=[down_x, east, west, south, north, up_z, up_x, down_z]}: west

In this case I can't find the lever's property because I'm asking for the wrong kind of direction (because levers on top and bottom can be rotated in 2 directions). But a ton of blocks have their own enums that you'll have to use to get those properties in every class in a case by case basis, which is way too much work.

An EnumFacing is required to activate blocks (as well as EntityPlayer but I'm skipping that for now), and normally that comes from what the player is looking at, so it would require teleporting a player object around and I want to avoid that. My goal now is to find another way to get a EnumFacing of a given coordinate for the couple blocks that need it and just null it in other cases.


RE: Redstone lab (Open source) - Chibill - 12-05-2014

if you need a player object use the way forge does a fake player and just change it facing you should not have to teleport it if it just looks at its facing and or rotation.


RE: Redstone lab (Open source) - CX gamer - 12-06-2014

Oh yes good. Until now I've only been extracting classes from minecraft.jar, but a PlayerEntity requires a GameProfile, which is in a mojang lib authlib. I have some code that will specially get that single class and use it to create a player now.

As for the facing problem, good point, no teleporting required. Still I'm pondering how to implement it, as I want the cleanest solution possible. Right now my best bet is just trying the 6 directions and checking which fail, but I'm not very pleased with that solution.


RE: Redstone lab (Open source) - CX gamer - 12-09-2014

Still stuck with authlib. When decompiling, its constructor asks for a UUID and a String, just like MC expects. But when accessing said class with reflection, suddenly it's String and String. Also the legacy and the PropertyMap fields are gone, as well as all related methods. There should be no SecurityManager denying me access. There is a UUIDTypeAdapter with converts between UUID and String, but I have no idea how it would change the constructor when calling it with reflection.


RE: Redstone lab (Open source) - Chibill - 12-09-2014

Why use reflection? its another file you could load as a library..... And actually import if its loaded before the class using it instance is created.