-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: develop
Are you sure you want to change the base?
Conversation
#14 Chunk Syncing
#14 Chunk Syncing
#14 Chunk Syncing
This means you should use SpatialLaunchWrapper instead of calling WorkerManager directly.
#14 Chunk Syncing
#15 World Loading
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
* 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
} | ||
|
||
/** | ||
* A single chunk holds 16x16x16 states. |
There was a problem hiding this comment.
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
public interface ISpatialWorld { | ||
Entity getEntityById(EntityId id); | ||
void addSpatial(Entity entity); | ||
void removeSpatial(Entity entity); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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>
?
workers/java/worker/src/main/java/com/hrznstudio/spatial/util/EntityRequirementCallback.java
Outdated
Show resolved
Hide resolved
return getData(entity, Metadata.COMPONENT).getEntityType(); | ||
} | ||
|
||
public static boolean isWithin(double a, double b, double dist) { |
There was a problem hiding this comment.
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;
workers/java/worker/src/main/java/com/hrznstudio/spatial/worker/entity/EntityWorker.java
Show resolved
Hide resolved
@@ -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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a logger !
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :/
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. |
No description provided.