Merge pull request #113 from GeyserMC/feature/1.15-je-1.14-be

Merge 1.15 Java and 1.14 Bedrock changes into master
This commit is contained in:
Redned 2019-12-18 08:28:59 -06:00 committed by GitHub
commit dae4bbbd44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 6052 additions and 5586 deletions

View file

@ -103,7 +103,7 @@
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.14.4-2-SNAPSHOT</version>
<version>1.15.1-1-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>

View file

@ -68,6 +68,7 @@ import java.util.concurrent.TimeUnit;
public class GeyserConnector implements Connector {
public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v388.V388_CODEC;
public static final int BEDROCK_1_14_PROTOCOL_VERSION = 389;
public static final String NAME = "Geyser";
public static final String VERSION = "1.0-SNAPSHOT";

View file

@ -27,7 +27,6 @@ package org.geysermc.connector.entity.living;
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.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;

View file

@ -26,6 +26,7 @@
package org.geysermc.connector.entity.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag;
import org.geysermc.connector.entity.type.EntityType;
@ -39,9 +40,15 @@ public class AgeableEntity extends CreatureEntity {
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 14) {
if (entityMetadata.getId() == 15) {
// TODO: Figure out why this value sometimes returns an integer
// At the time of writing this, the value here sometimes returns as an int
// rather than a boolean for donkeys. The wiki.vg documentation is lacking at the
// time of writing this, but once this value is known, the bug will be fixed accordingly.
if (entityMetadata.getType() == MetadataType.BOOLEAN) {
metadata.getFlags().setFlag(EntityFlag.BABY, (boolean) entityMetadata.getValue());
}
}
super.updateBedrockMetadata(entityMetadata, session);
}

View file

@ -41,7 +41,7 @@ public class InsentientEntity extends LivingEntity {
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 13 && entityMetadata.getType() == MetadataType.BYTE) {
if (entityMetadata.getId() == 14 && entityMetadata.getType() == MetadataType.BYTE) {
byte xd = (byte) entityMetadata.getValue();
metadata.getFlags().setFlag(EntityFlag.NO_AI, (xd & 0x01) == 0x01);
}

View file

@ -40,7 +40,7 @@ public class HorseEntity extends AbstractHorseEntity {
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 17) {
if (entityMetadata.getId() == 18) {
metadata.put(EntityData.VARIANT, (int) entityMetadata.getValue());
}

View file

@ -0,0 +1,37 @@
/*
* 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.nukkitx.math.vector.Vector3f;
import org.geysermc.connector.entity.living.ChestedHorseEntity;
import org.geysermc.connector.entity.type.EntityType;
public class LlamaEntity extends ChestedHorseEntity {
public LlamaEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, entityType, position, motion, rotation);
}
}

View file

@ -41,7 +41,7 @@ public class GuardianEntity extends MonsterEntity {
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 15) {
if (entityMetadata.getId() == 16) {
Entity entity = session.getEntityCache().getEntityByJavaId((int) entityMetadata.getValue());
if (entity != null) {
metadata.put(EntityData.TARGET_EID, entity.getGeyserId());

View file

@ -29,6 +29,7 @@ import lombok.Getter;
import org.geysermc.connector.entity.*;
import org.geysermc.connector.entity.living.*;
import org.geysermc.connector.entity.living.horse.HorseEntity;
import org.geysermc.connector.entity.living.horse.LlamaEntity;
import org.geysermc.connector.entity.living.monster.GuardianEntity;
import org.geysermc.connector.entity.living.monster.ZombieEntity;
@ -47,14 +48,15 @@ public enum EntityType {
BAT(AmbientEntity.class, 19, 0.9f, 0.5f),
IRON_GOLEM(GolemEntity.class, 20, 2.7f, 1.4f),
SNOW_GOLEM(GolemEntity.class, 21, 1.9f, 0.7f),
OCELOT(TameableEntity.class, 22, 0.35f, 0.3f),
OCELOT(AgeableEntity.class, 22, 0.35f, 0.3f),
HORSE(HorseEntity.class, 23, 1.6f, 1.3965f),
DONKEY(ChestedHorseEntity.class, 24, 1.6f, 1.3965f),
MULE(ChestedHorseEntity.class, 25, 1.6f, 1.3965f),
SKELETON_HORSE(AbstractHorseEntity.class, 26, 1.6f, 1.3965f),
ZOMBIE_HORSE(AbstractHorseEntity.class, 27, 1.6f, 1.3965f),
POLAR_BEAR(AnimalEntity.class, 28, 1.4f, 1.3f),
LLAMA(ChestedHorseEntity.class, 29, 1.87f, 0.9f),
LLAMA(LlamaEntity.class, 29, 1.87f, 0.9f),
TRADER_LLAMA(LlamaEntity.class, 29, 1.187f, 0.9f),
PARROT(TameableEntity.class, 30, 0.9f, 0.5f),
DOLPHIN(WaterEntity.class, 31, 0.6f, 0.9f),
ZOMBIE(ZombieEntity.class, 32, 1.8f, 0.6f, 0.6f, 1.62f),
@ -140,7 +142,8 @@ public enum EntityType {
TROPICAL_FISH(AbstractFishEntity.class, 111, 0.6f, 0.6f),
COD(AbstractFishEntity.class, 112, 0.25f, 0.5f),
PANDA(AnimalEntity.class, 113, 1.25f, 1.125f, 1.825f),
FOX(AnimalEntity.class, 121, 0.5f, 1.25f);
FOX(AnimalEntity.class, 121, 0.5f, 1.25f),
BEE(InsentientEntity.class, 122, 0.6f, 0.6f);
private Class<? extends Entity> entityClass;
private final int type;

View file

@ -45,8 +45,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
@Override
public boolean handle(LoginPacket loginPacket) {
if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
connector.getLogger().debug("unsupported");
if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_1_14_PROTOCOL_VERSION) {
session.getUpstream().disconnect("Unsupported Bedrock version. Are you running an outdated version?");
return true;
}

View file

@ -1,4 +1,5 @@
[
{
"items" : [
{
"id" : 5
},
@ -638,6 +639,12 @@
{
"id" : 165
},
{
"id" : -220
},
{
"id" : -221
},
{
"id" : 170
},
@ -1244,6 +1251,9 @@
"id" : 6,
"damage" : 5
},
{
"id" : -218
},
{
"id" : 295
},
@ -1304,6 +1314,9 @@
{
"id" : 91
},
{
"id" : 736
},
{
"id" : 31,
"damage" : 2
@ -1678,6 +1691,10 @@
"id" : 383,
"damage" : 10
},
{
"id" : 383,
"damage" : 122
},
{
"id" : 383,
"damage" : 11
@ -2976,6 +2993,9 @@
{
"id" : -202
},
{
"id" : -219
},
{
"id" : 720
},
@ -2988,6 +3008,21 @@
{
"id" : -198
},
{
"id" : 238,
"damage" : 8
},
{
"id" : 238
},
{
"id" : 238,
"damage" : 12
},
{
"id" : 238,
"damage" : 4
},
{
"id" : 379
},
@ -3179,6 +3214,9 @@
{
"id" : 389
},
{
"id" : 737
},
{
"id" : 390
},
@ -3381,6 +3419,363 @@
{
"id" : 386
},
{
"id" : 36
},
{
"id" : -12
},
{
"id" : -13
},
{
"id" : -14
},
{
"id" : -15
},
{
"id" : -16
},
{
"id" : -17
},
{
"id" : -18
},
{
"id" : -19
},
{
"id" : -20
},
{
"id" : -21
},
{
"id" : -22
},
{
"id" : -23
},
{
"id" : -24
},
{
"id" : -25
},
{
"id" : -26
},
{
"id" : -27
},
{
"id" : -28
},
{
"id" : -29
},
{
"id" : -30
},
{
"id" : -31
},
{
"id" : -32
},
{
"id" : -33
},
{
"id" : -34
},
{
"id" : -35
},
{
"id" : -36
},
{
"id" : -37
},
{
"id" : -38
},
{
"id" : -39
},
{
"id" : -40
},
{
"id" : -41
},
{
"id" : -42
},
{
"id" : -43
},
{
"id" : -44
},
{
"id" : -45
},
{
"id" : -46
},
{
"id" : -47
},
{
"id" : -48
},
{
"id" : -49
},
{
"id" : -50
},
{
"id" : -51
},
{
"id" : -52
},
{
"id" : -53
},
{
"id" : -54
},
{
"id" : -55
},
{
"id" : -56
},
{
"id" : -57
},
{
"id" : -58
},
{
"id" : -59
},
{
"id" : -60
},
{
"id" : -61
},
{
"id" : -62
},
{
"id" : -63
},
{
"id" : -64
},
{
"id" : -65
},
{
"id" : -66
},
{
"id" : -67
},
{
"id" : -68
},
{
"id" : -69
},
{
"id" : -70
},
{
"id" : -71
},
{
"id" : -72
},
{
"id" : -73
},
{
"id" : -74
},
{
"id" : -75
},
{
"id" : -76
},
{
"id" : -77
},
{
"id" : -78
},
{
"id" : -79
},
{
"id" : -80
},
{
"id" : -81
},
{
"id" : -82
},
{
"id" : -83
},
{
"id" : -84
},
{
"id" : -85
},
{
"id" : -86
},
{
"id" : -87
},
{
"id" : -88
},
{
"id" : -89
},
{
"id" : -90
},
{
"id" : -91
},
{
"id" : -92
},
{
"id" : -93
},
{
"id" : -94
},
{
"id" : -95
},
{
"id" : -96
},
{
"id" : -97
},
{
"id" : -98
},
{
"id" : -99
},
{
"id" : -100
},
{
"id" : -101
},
{
"id" : -102
},
{
"id" : -103
},
{
"id" : -104
},
{
"id" : -105
},
{
"id" : -106
},
{
"id" : -107
},
{
"id" : -108
},
{
"id" : -109
},
{
"id" : -110
},
{
"id" : -111
},
{
"id" : -112
},
{
"id" : -113
},
{
"id" : -114
},
{
"id" : -115
},
{
"id" : -116
},
{
"id" : -117
},
{
"id" : -118
},
{
"id" : -119
},
{
"id" : -120
},
{
"id" : -121
},
{
"id" : -122
},
{
"id" : -123
},
{
"id" : -124
},
{
"id" : -125
},
{
"id" : -126
},
{
"id" : -127
},
{
"id" : -128
},
{
"id" : -129
},
{
"id" : 403,
"nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgMAbHZsAQACAgBpZAAAAAA="
@ -4178,3 +4573,4 @@
"nbt_b64" : "CgAAAwsAY3VzdG9tQ29sb3KcnBb/Cg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABgEMAEZpcmV3b3JrVHlwZQAHDABGaXJld29ya0ZhZGUAAAAAAQ0ARmlyZXdvcmtUcmFpbAABDwBGaXJld29ya0ZsaWNrZXIAAAA="
}
]
}

View file

@ -7,14 +7,6 @@
"name" : "minecraft:air",
"id" : -158
},
{
"name": "minecraft:stripped_jungle_log",
"id": -7
},
{
"name": "minecraft:unlit_redstone_torch",
"id": 75
},
{
"name" : "minecraft:item.birch_door",
"id" : 194
@ -371,10 +363,6 @@
"name" : "minecraft:melon_seeds",
"id" : 362
},
{
"name": "minecraft:lit_redstone_ore",
"id": 74
},
{
"name" : "minecraft:nether_wart",
"id" : 372
@ -1495,6 +1483,22 @@
"name" : "minecraft:suspicious_stew",
"id" : 734
},
{
"name" : "minecraft:birch_fence_gate",
"id" : 184
},
{
"name" : "minecraft:honeycomb",
"id" : 736
},
{
"name" : "minecraft:element_115",
"id" : -126
},
{
"name" : "minecraft:honey_bottle",
"id" : 737
},
{
"name" : "minecraft:element_4",
"id" : -15
@ -1519,6 +1523,10 @@
"name" : "minecraft:element_40",
"id" : -51
},
{
"name" : "minecraft:honey_block",
"id" : -220
},
{
"name" : "minecraft:rapid_fertilizer",
"id" : 449
@ -2179,14 +2187,6 @@
"name" : "minecraft:element_114",
"id" : -125
},
{
"name": "minecraft:birch_fence_gate",
"id": 184
},
{
"name": "minecraft:element_115",
"id": -126
},
{
"name" : "minecraft:element_117",
"id" : -128
@ -2259,6 +2259,10 @@
"name" : "minecraft:lapis_ore",
"id" : 21
},
{
"name" : "minecraft:beehive",
"id" : -219
},
{
"name" : "minecraft:item.bed",
"id" : 26
@ -2347,6 +2351,18 @@
"name" : "minecraft:item.iron_door",
"id" : 71
},
{
"name" : "minecraft:lit_redstone_ore",
"id" : 74
},
{
"name" : "minecraft:stripped_jungle_log",
"id" : -7
},
{
"name" : "minecraft:unlit_redstone_torch",
"id" : 75
},
{
"name" : "minecraft:red_nether_brick_stairs",
"id" : -184
@ -2782,5 +2798,13 @@
{
"name" : "minecraft:item.campfire",
"id" : -209
},
{
"name" : "minecraft:bee_nest",
"id" : -218
},
{
"name" : "minecraft:honeycomb_block",
"id" : -221
}
]

@ -1 +1 @@
Subproject commit 3d4147f001266d01eae6b8479428ca77bb5bf0c3
Subproject commit 0f3d65b65076b16fc7dc9226230b31291b8f2cde