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

[WIP] Feature/expanse 2 #34

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from
Open

[WIP] Feature/expanse 2 #34

wants to merge 58 commits into from

Conversation

Bluexin
Copy link
Collaborator

@Bluexin Bluexin commented Feb 25, 2019

No description provided.

Bluexin and others added 30 commits January 24, 2019 17:44
#14 Chunk Syncing
This means you should use SpatialLaunchWrapper instead of calling
WorkerManager directly.
I still have to figure out how to get the client to receive entities
(the View remains empty, and web panel shows no readable entities)

#14 Chunk Syncing
(cherry picked from commit a2c1dee)
Fix a few stupid mistakes as well
I'm so sorry for anyone who reads this
Coded and others added 18 commits February 4, 2019 16:53
* Add external launch config for ChunkWorker

#14 Chunk Syncing

* Revamp chunk schema

#14 Chunk Syncing

* Use updated reservation api

* Fix gradle fatjar and ChunkWorker executable path

#14 Chunk Syncing

* Abstract away the connection manager

* Add worker manager

* Fix mistake in worker manager

* Move service definition

* Run the WorkerManager trough LaunchWrapper

This means you should use SpatialLaunchWrapper instead of calling
WorkerManager directly.

* Connect the Chunk Worker

#14 Chunk Syncing

* Add a connection callback to the ConnectionManager

* Add support for View Mode in ConnectionManager

* Update entity db

* Add dummy chunk generation ability to the chunk worker

* Let the client (dis)connect to/from the server

#15 World Loading

* Fix ConnectionManager to act as keep-alive again

* Fix chunk creation after database upgrade

* Let consumers give their own Dispatcher implementation

* Read chunk data from client (almost)

I still have to figure out how to get the client to receive entities
(the View remains empty, and web panel shows no readable entities)

#14 Chunk Syncing

* add worker-sdk build.gradle

(cherry picked from commit a2c1dee)

* Package mc & forge in the workers builds

* Fix manifests

* Fix worker types and implement base worker + doc

* Let chunk workers & clients get entities data

Fix a few stupid mistakes as well

* Render the world

I'm so sorry for anyone who reads this

* Update branding

* Wah?

* Disable brand mixin

* Implement world converter

* Update entity schema

* Update chunk provider y level

* Fix some issues with chunk loading

* Update player id on client worker

* Add default snapshot to test with

* Fix chunk loading for real and update snapshot

* Update spatial launch config

* Update spatial launch config (fix derp)

* Clean up some leftovers
@Bluexin Bluexin marked this pull request as ready for review February 25, 2019 15:16
}

/**
* A single chunk holds 16x16x16 states.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copypasta doc comment should be fixed

schema/components/bootstrap.schema Outdated Show resolved Hide resolved
public interface ISpatialWorld {
Entity getEntityById(EntityId id);
void addSpatial(Entity entity);
void removeSpatial(Entity entity);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO one shouldn't need documentation in code, but interfaces can use it.
It might help me understand these methods, as they're not very clear to me (spatial but then they take n.m.e.Entity ??)

EntityOtherPlayerMP mp = new EntityOtherPlayerMP(world, profile);
double d0 = pos.getX();
double d1 = pos.getY();
double d2 = pos.getZ();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x, y, z
However in this case why not just use pos.get[XYZ]()? I see no benefit to local vars here.

double d1 = pos.getY();
double d2 = pos.getZ();
float f = (rotation.getYaw() * 360) / 256.0F;
float f1 = (rotation.getPitch() * 360) / 256.0F;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaw, pitch
They only have 1 usage (which is even several lines below), and the only benefit to not inlining them would be for clarity -- which is not increased with non clear names (on top of having the usage split so far away from the declaration).

int extensionID = extensionNibble == null ? 0 : extensionNibble.get(j, k, l);
int blockID = extensionID << 8 | (b & 255);
int meta = metaNibble.get(j, k, l);
if (map.get(blockID).getId().equals("minecraft:air"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be shifted one line up to avoid array lookup

}

@FunctionalInterface
public interface Callback {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use stl's Consumer<EntityId> ?

return getData(entity, Metadata.COMPONENT).getEntityType();
}

public static boolean isWithin(double a, double b, double dist) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like something very common, which one of the innumerable mc libs already has.
Moreover, an implementation like this seems more efficient :

return Math.abs(a - b) <= dist;

@@ -42,6 +44,11 @@ protected void onConnected() {
}
});

getDispatcher().onCommandRequest(PlayerInput.Commands.ITEM_RIGHTCLICK, argument -> {
System.out.println("Received right click with hand " + (argument.request.getMain() ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND).name());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a logger !

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a temporary debug output

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen those temporary debug outputs too many times in production :/

@CLAassistant
Copy link

CLAassistant commented May 3, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Coded
❌ Bluexin


Coded seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

3 participants