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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e8f7981
Add external launch config for ChunkWorker
Bluexin Jan 24, 2019
fbe5e08
Revamp chunk schema
Bluexin Jan 24, 2019
614025d
Use updated reservation api
Jan 24, 2019
dd67e1d
Fix gradle fatjar and ChunkWorker executable path
Bluexin Jan 24, 2019
ebcd760
Abstract away the connection manager
Bluexin Jan 24, 2019
c97adb9
Add worker manager
Jan 24, 2019
10353ea
Fix mistake in worker manager
Jan 24, 2019
b531e29
Move service definition
Jan 24, 2019
1c20f80
Run the WorkerManager trough LaunchWrapper
Bluexin Jan 25, 2019
cf47f6f
Connect the Chunk Worker
Bluexin Jan 25, 2019
fcad5ca
Add a connection callback to the ConnectionManager
Bluexin Jan 25, 2019
d450926
Add support for View Mode in ConnectionManager
Bluexin Jan 25, 2019
a1fb38b
Update entity db
Bluexin Jan 25, 2019
0970cac
Add dummy chunk generation ability to the chunk worker
Bluexin Jan 26, 2019
8da1413
Let the client (dis)connect to/from the server
Bluexin Jan 26, 2019
b29b96d
Fix ConnectionManager to act as keep-alive again
Bluexin Jan 26, 2019
d13a4dd
Fix chunk creation after database upgrade
Bluexin Jan 26, 2019
5c4fde1
Let consumers give their own Dispatcher implementation
Bluexin Jan 26, 2019
68e24c0
Read chunk data from client (almost)
Bluexin Jan 26, 2019
3eca72c
add worker-sdk build.gradle
Jan 24, 2019
2f1445f
Package mc & forge in the workers builds
Bluexin Jan 26, 2019
8cb5969
Fix manifests
Bluexin Jan 26, 2019
5c6fd95
Fix worker types and implement base worker + doc
Bluexin Jan 27, 2019
1a0560a
Let chunk workers & clients get entities data
Bluexin Jan 27, 2019
f3461b9
Render the world
Jan 27, 2019
09cb661
Update branding
Jan 29, 2019
739ae33
Wah?
Jan 29, 2019
f375cbe
Merge branch 'develop' into feature/Spatial-14
Jan 31, 2019
71cb04b
Disable brand mixin
Feb 2, 2019
536f6d2
Implement world converter
Feb 2, 2019
ba05ffe
Update entity schema
Feb 2, 2019
148c7b6
Update chunk provider y level
Feb 2, 2019
a85879b
Fix some issues with chunk loading
Bluexin Feb 4, 2019
495f695
Update player id on client worker
Feb 4, 2019
926bcc7
Add default snapshot to test with
Feb 4, 2019
3434ab8
Work on entity syncing
Feb 4, 2019
4bc47bf
Fix chunk loading for real and update snapshot
Bluexin Feb 4, 2019
bb8606e
Update spatial launch config
Bluexin Feb 4, 2019
39c4795
Merge remote-tracking branch 'origin/feature/Spatial-14' into feature…
Feb 4, 2019
f6b706f
Update spatial launch config (fix derp)
Bluexin Feb 4, 2019
0b8a57a
Merge remote-tracking branch 'origin/feature/Spatial-14' into feature…
Feb 4, 2019
da82240
[WIP] World loading and syncing to clients (#14 #15) (#19)
Bluexin Feb 4, 2019
9e742f1
Merge branch 'develop' into feature/Expanse-2
Feb 5, 2019
916bd2d
Fix some issue with chunks
Feb 6, 2019
adfea00
Improve component requirements
Feb 7, 2019
616c340
Fix world converter formatting
Feb 7, 2019
109aef7
Fix worker service
Feb 8, 2019
d6d4c14
Add attributes to client worker
Feb 8, 2019
3c78d8f
Implement entity worker and client disconnection
Feb 8, 2019
a341bf5
Prevent player from directly updating position
Feb 12, 2019
9eb5f9c
Player syncing
Feb 12, 2019
9347eb3
Bootstrapper
Feb 25, 2019
9eea4ab
Customize main menu
Feb 25, 2019
95d40e9
Reduce timeout time to 5 seconds
Feb 25, 2019
aba5c3e
Remove used entities from the requirement callback
Feb 25, 2019
e701126
Fix *some* worker issues, update to SpatialOS 13.6.1
Bluexin Feb 27, 2019
b2456bf
Do a bit more on player syncing
Feb 28, 2019
b218f7e
Send right click with item
Feb 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions schema/components/player.schema
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package minecraft.player;

import "improbable/vector3.schema";
import "components/general.schema";

// Reserves 1450-1499

Expand All @@ -20,12 +21,17 @@ component MapRepresentation {
string icon = 2;
}

type Hand {
bool main = 1;
}

component PlayerInput {
id = 1451;
improbable.Vector3f move_position = 1;
improbable.Vector3f desired_motion = 2;
bool sprinting = 3;
bool sneaking = 4;
command minecraft.general.Void item_rightclick(Hand);
}

type Heartbeat {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package com.hrznstudio.spatial.client.vanillawrappers;

import com.hrznstudio.spatial.SpatialMod;
import com.hrznstudio.spatial.client.HorizonClientWorker;
import com.hrznstudio.spatial.util.ConnectionManager;
import improbable.collections.Option;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import minecraft.player.Hand;
import minecraft.player.PlayerInput;
import net.minecraft.network.*;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.ITextComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -54,7 +61,13 @@ public void setNetHandler(INetHandler handler) {

@Override
public void sendPacket(Packet<?> packetIn) {
logger.info(() -> "SpatialNetworkManager#sendPacket not implemented (received " + packetIn.getClass() + ")");
if (packetIn instanceof CPacketPlayerTryUseItem) {
Hand hand = Hand.create();
hand.setMain(((CPacketPlayerTryUseItem) packetIn).getHand() == EnumHand.MAIN_HAND);
ConnectionManager.getConnection().sendCommandRequest(PlayerInput.Commands.ITEM_RIGHTCLICK, SpatialMod.getClientWorker().getPlayerId(), hand, Option.empty());
} else {
logger.info(() -> "SpatialNetworkManager#sendPacket not implemented for received packet (" + packetIn.getClass() + ")");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import improbable.worker.EntityId;
import minecraft.entity.Motion;
import minecraft.entity.WorldEntity;
import minecraft.general.Void;
import minecraft.player.PlayerConnection;
import minecraft.player.PlayerInput;
import net.minecraft.init.Bootstrap;
import net.minecraft.util.EnumHand;

import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -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 :/

getConnection().sendCommandResponse(PlayerInput.Commands.ITEM_RIGHTCLICK, argument.requestId, Void.create());
});

getDispatcher().onComponentUpdate(PlayerInput.COMPONENT, argument -> {
if (getDispatcher().getAuthority(Position.COMPONENT, argument.entityId) != Authority.NOT_AUTHORITATIVE) {
Vector3f pos = argument.update.getMovePosition().orElse(null);
Expand Down Expand Up @@ -78,7 +85,7 @@ protected void onConnected() {
});

service.scheduleAtFixedRate(() -> {
if(!playerTimeout.isEmpty()) {
if (!playerTimeout.isEmpty()) {
new HashSet<>(playerTimeout.keySet()).forEach(id -> {
int i = playerTimeout.get(id);
if (i == 0) {
Expand Down