Merge remote-tracking branch 'remotes/upstream/master' into inventory

# Conflicts:
#	connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java
This commit is contained in:
AJ Ferguson 2019-12-06 14:06:24 -09:00
commit 211436c1e0
12 changed files with 74 additions and 110 deletions

View file

@ -19,6 +19,8 @@ jobs:
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 1.8
- name: submodules-init
uses: snickerbockers/submodules-init@v4
- name: Build with Maven - name: Build with Maven
run: mvn -B package run: mvn -B package
- name: Archive artifacts - name: Archive artifacts

View file

@ -10,12 +10,6 @@
</parent> </parent>
<artifactId>api</artifactId> <artifactId>api</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>

View file

@ -9,50 +9,4 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<dependencies>
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>opennbt</artifactId>
<version>1.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>packetlib</artifactId>
<version>1.4-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>mcauthlib</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.14.4-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.github.steveice10</groupId>
<artifactId>opennbt</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.steveice10</groupId>
<artifactId>packetlib</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.steveice10</groupId>
<artifactId>mcauthlib</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.3.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project> </project>

View file

@ -44,7 +44,6 @@
<groupId>net.minecrell</groupId> <groupId>net.minecrell</groupId>
<artifactId>terminalconsoleappender</artifactId> <artifactId>terminalconsoleappender</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -59,12 +58,6 @@
<version>1.6.4</version> <version>1.6.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.fusesource.jansi</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId> <artifactId>jansi</artifactId>
@ -74,7 +67,7 @@
<dependency> <dependency>
<groupId>com.nukkitx.protocol</groupId> <groupId>com.nukkitx.protocol</groupId>
<artifactId>bedrock-v388</artifactId> <artifactId>bedrock-v388</artifactId>
<version>2.4.0</version> <version>2.4.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -129,7 +122,7 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${outputName}-noshade</finalName> <finalName>${project.parent.name}-noshade</finalName>
<directory>../target</directory> <directory>../target</directory>
<plugins> <plugins>
<plugin> <plugin>
@ -147,7 +140,7 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<configuration> <configuration>
<finalName>${outputName}</finalName> <finalName>${project.parent.name}</finalName>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -162,7 +155,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<finalName>${outputName}</finalName> <finalName>${project.parent.name}</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached> <shadedArtifactAttached>true</shadedArtifactAttached>
<minimizeJar>true</minimizeJar> <minimizeJar>true</minimizeJar>
</configuration> </configuration>

View file

@ -39,10 +39,6 @@ public class AbstractHorseEntity extends AnimalEntity {
@Override @Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 17) {
metadata.put(EntityData.VARIANT, (int) entityMetadata.getValue());
}
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
} }
} }

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2019 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.connector.entity.living.horse;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData;
import org.geysermc.connector.entity.living.AbstractHorseEntity;
import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;
public class HorseEntity extends AbstractHorseEntity {
public HorseEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, entityType, position, motion, rotation);
}
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 17) {
metadata.put(EntityData.VARIANT, (int) entityMetadata.getValue());
}
super.updateBedrockMetadata(entityMetadata, session);
}
}

View file

@ -28,6 +28,7 @@ package org.geysermc.connector.entity.type;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.entity.*; import org.geysermc.connector.entity.*;
import org.geysermc.connector.entity.living.*; import org.geysermc.connector.entity.living.*;
import org.geysermc.connector.entity.living.horse.HorseEntity;
import org.geysermc.connector.entity.living.monster.GuardianEntity; import org.geysermc.connector.entity.living.monster.GuardianEntity;
import org.geysermc.connector.entity.living.monster.ZombieEntity; import org.geysermc.connector.entity.living.monster.ZombieEntity;
@ -47,7 +48,7 @@ public enum EntityType {
IRON_GOLEM(GolemEntity.class, 20, 2.7f, 1.4f), IRON_GOLEM(GolemEntity.class, 20, 2.7f, 1.4f),
SNOW_GOLEM(GolemEntity.class, 21, 1.9f, 0.7f), SNOW_GOLEM(GolemEntity.class, 21, 1.9f, 0.7f),
OCELOT(TameableEntity.class, 22, 0.35f, 0.3f), OCELOT(TameableEntity.class, 22, 0.35f, 0.3f),
HORSE(AbstractHorseEntity.class, 23, 1.6f, 1.3965f), HORSE(HorseEntity.class, 23, 1.6f, 1.3965f),
DONKEY(ChestedHorseEntity.class, 24, 1.6f, 1.3965f), DONKEY(ChestedHorseEntity.class, 24, 1.6f, 1.3965f),
MULE(ChestedHorseEntity.class, 25, 1.6f, 1.3965f), MULE(ChestedHorseEntity.class, 25, 1.6f, 1.3965f),
SKELETON_HORSE(AbstractHorseEntity.class, 26, 1.6f, 1.3965f), SKELETON_HORSE(AbstractHorseEntity.class, 26, 1.6f, 1.3965f),
@ -101,8 +102,7 @@ public enum EntityType {
FIREWORK_ROCKET(Entity.class, 72, 0f), FIREWORK_ROCKET(Entity.class, 72, 0f),
TRIDENT(ArrowEntity.class, 73, 0f), TRIDENT(ArrowEntity.class, 73, 0f),
TURTLE(AnimalEntity.class, 74, 0.4f, 1.2f), TURTLE(AnimalEntity.class, 74, 0.4f, 1.2f),
// TODO CAT (need to figure out how to deal with baby cats) https://github.com/NukkitX/Nukkit/blob/master/src/main/java/cn/nukkit/entity/passive/EntityCat.java CAT(TameableEntity.class, 75, 0.35f, 0.3f),
SHULKER_BULLET(Entity.class, 76, 0f), SHULKER_BULLET(Entity.class, 76, 0f),
FISHING_BOBBER(Entity.class, 77, 0f), FISHING_BOBBER(Entity.class, 77, 0f),
CHALKBOARD(Entity.class, 78, 0f), CHALKBOARD(Entity.class, 78, 0f),

View file

@ -45,14 +45,7 @@ import com.nukkitx.protocol.bedrock.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.ContainerId;
import com.nukkitx.protocol.bedrock.data.GamePublishSetting; import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
import com.nukkitx.protocol.bedrock.data.GameRule; import com.nukkitx.protocol.bedrock.data.GameRule;
import com.nukkitx.protocol.bedrock.packet.AvailableEntityIdentifiersPacket; import com.nukkitx.protocol.bedrock.packet.*;
import com.nukkitx.protocol.bedrock.packet.BiomeDefinitionListPacket;
import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket;
import com.nukkitx.protocol.bedrock.packet.NetworkChunkPublisherUpdatePacket;
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.packet.TextPacket;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.api.Player; import org.geysermc.api.Player;
@ -305,7 +298,7 @@ public class GeyserSession implements Player {
startGamePacket.setLevelGamemode(0); startGamePacket.setLevelGamemode(0);
startGamePacket.setDifficulty(1); startGamePacket.setDifficulty(1);
startGamePacket.setDefaultSpawn(Vector3i.ZERO); startGamePacket.setDefaultSpawn(Vector3i.ZERO);
startGamePacket.setAcheivementsDisabled(true); startGamePacket.setAchievementsDisabled(true);
startGamePacket.setTime(-1); startGamePacket.setTime(-1);
startGamePacket.setEduEditionOffers(0); startGamePacket.setEduEditionOffers(0);
startGamePacket.setEduFeaturesEnabled(false); startGamePacket.setEduFeaturesEnabled(false);

View file

@ -64,7 +64,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
double javaY = packet.getPosition().getY() - EntityType.PLAYER.getOffset(); double javaY = packet.getPosition().getY() - EntityType.PLAYER.getOffset();
ClientPlayerPositionRotationPacket playerPositionRotationPacket = new ClientPlayerPositionRotationPacket( ClientPlayerPositionRotationPacket playerPositionRotationPacket = new ClientPlayerPositionRotationPacket(
packet.isOnGround(), packet.getPosition().getX(), Math.ceil(javaY * 2) / 2, packet.isOnGround(), packet.getPosition().getX(), javaY,
packet.getPosition().getZ(), packet.getRotation().getY(), packet.getRotation().getX() packet.getPosition().getZ(), packet.getRotation().getY(), packet.getRotation().getX()
); );

View file

@ -7,12 +7,12 @@ import com.nukkitx.protocol.bedrock.data.SerializedSkin;
import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.apache.commons.codec.Charsets;
import org.geysermc.api.Geyser; import org.geysermc.api.Geyser;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.entity.PlayerEntity; import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import java.nio.charset.StandardCharsets;
import java.util.Base64; import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.UUID; import java.util.UUID;
@ -80,7 +80,7 @@ public class SkinUtils {
try { try {
GameProfile.Property skinProperty = profile.getProperty("textures"); GameProfile.Property skinProperty = profile.getProperty("textures");
JsonObject skinObject = SkinProvider.GSON.fromJson(new String(Base64.getDecoder().decode(skinProperty.getValue()), Charsets.UTF_8), JsonObject.class); JsonObject skinObject = SkinProvider.GSON.fromJson(new String(Base64.getDecoder().decode(skinProperty.getValue()), StandardCharsets.UTF_8), JsonObject.class);
JsonObject textures = skinObject.getAsJsonObject("textures"); JsonObject textures = skinObject.getAsJsonObject("textures");
JsonObject skinTexture = textures.getAsJsonObject("SKIN"); JsonObject skinTexture = textures.getAsJsonObject("SKIN");

@ -1 +1 @@
Subproject commit 5ec6f1f339506129514de59d0e09e9b2c612e8be Subproject commit 3d4147f001266d01eae6b8479428ca77bb5bf0c3

37
pom.xml
View file

@ -7,7 +7,7 @@
<artifactId>geyser-parent</artifactId> <artifactId>geyser-parent</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>GeyserMC</name> <name>Geyser</name>
<description>Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers.</description> <description>Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers.</description>
<url>https://geysermc.org</url> <url>https://geysermc.org</url>
@ -83,33 +83,16 @@
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
</plugin>
</plugins>
</build> </build>
</project> </project>