Merge branch 'master' of https://github.com/GeyserMC/Geyser into feature/build-prs

This commit is contained in:
SupremeMortal 2019-11-28 23:14:04 +00:00
commit 8fb2807c46
No known key found for this signature in database
GPG key ID: DDBB25F8EE4FA29A
63 changed files with 1695 additions and 17232 deletions

12
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: GeyserMC
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View file

@ -27,7 +27,7 @@ If applicable, add screenshots to help explain your problem.
run /version
**Geyser version**
Not yet
Jenkins
**Bedrock version**
The version of your Minecraft pe

17
.github/workflows/maven.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Java CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml

View file

@ -1,4 +1,4 @@
<img src="https://geysermc.org/img/geyserlogo.png" alt="Geyser" width="600" height="170"/>
<img src="https://geysermc.org/img/geyserlogo.png" alt="Geyser" width="600"/>
[![forthebadge made-with-java](http://ForTheBadge.com/images/badges/made-with-java.svg)](https://java.com/)

View file

@ -67,7 +67,7 @@ public interface Connector {
*
* @return a collection of the connected players
*/
Collection<Player> getConnectedPlayers();
Collection<? extends Player> getConnectedPlayers();
/**
* Shuts down the connector

View file

@ -97,7 +97,7 @@ public class Geyser {
*
* @return a collection of the connected players
*/
public static Collection<Player> getConnectedPlayers() {
public static Collection<? extends Player> getConnectedPlayers() {
return connector.getConnectedPlayers();
}
}

View file

@ -74,8 +74,8 @@
</dependency>
<dependency>
<groupId>com.nukkitx.protocol</groupId>
<artifactId>bedrock-v361</artifactId>
<version>2.3.0</version>
<artifactId>bedrock-v388</artifactId>
<version>2.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -105,7 +105,7 @@
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.14.4-SNAPSHOT</version>
<version>1.14.4-2-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@ -164,4 +164,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -27,7 +27,8 @@ package org.geysermc.connector;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.BedrockServer;
import com.nukkitx.protocol.bedrock.v361.Bedrock_v361;
import com.nukkitx.protocol.bedrock.v388.Bedrock_v388;
import lombok.Getter;
import org.fusesource.jansi.AnsiConsole;
import org.geysermc.api.Connector;
@ -43,6 +44,7 @@ import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.metrics.Metrics;
import org.geysermc.connector.network.ConnectorServerEventHandler;
import org.geysermc.connector.network.remote.RemoteJavaServer;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.TranslatorsInit;
import org.geysermc.connector.plugin.GeyserPluginLoader;
import org.geysermc.connector.plugin.GeyserPluginManager;
@ -54,7 +56,6 @@ import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@ -66,12 +67,12 @@ import java.util.concurrent.TimeUnit;
@Getter
public class GeyserConnector implements Connector {
public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v361.V361_CODEC;
public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v388.V388_CODEC;
public static final String NAME = "Geyser";
public static final String VERSION = "1.0-SNAPSHOT";
private final Map<Object, Player> players = new HashMap<>();
private final Map<Object, GeyserSession> players = new HashMap<>();
private static GeyserConnector instance;
@ -96,7 +97,6 @@ public class GeyserConnector implements Connector {
}
private GeyserConnector() {
long startupTime = System.currentTimeMillis();
// Metric
@ -110,13 +110,12 @@ public class GeyserConnector implements Connector {
logger.info("******************************************");
logger.info("");
logger.info("Loading " + NAME + " vesion " + VERSION);
logger.info("Loading " + NAME + " version " + VERSION);
logger.info("");
logger.info("******************************************");
try {
File configFile = FileUtils.fileOrCopiedFromResource("config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()));
config = FileUtils.loadConfig(configFile, GeyserConfiguration.class);
} catch (IOException ex) {
logger.severe("Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!", ex);
@ -129,6 +128,7 @@ public class GeyserConnector implements Connector {
logger.setDebug(config.isDebugMode());
Toolbox.init();
TranslatorsInit.start();
commandMap = new GeyserCommandMap(this);
@ -165,8 +165,9 @@ public class GeyserConnector implements Connector {
logger.info(String.format("Done (%ss)! Run /help for help!", new DecimalFormat("#.###").format(completeTime)));
}
public Collection<Player> getConnectedPlayers() {
return new ArrayList<>(players.values());
@Override
public Collection<? extends Player> getConnectedPlayers() {
return players.values();
}
public void shutdown() {
@ -182,13 +183,13 @@ public class GeyserConnector implements Connector {
System.exit(0);
}
public void addPlayer(Player player) {
public void addPlayer(GeyserSession player) {
players.put(player.getAuthenticationData().getName(), player);
players.put(player.getAuthenticationData().getUUID(), player);
players.put(player.getSocketAddress(), player);
}
public void removePlayer(Player player) {
public void removePlayer(GeyserSession player) {
players.remove(player.getAuthenticationData().getName());
players.remove(player.getAuthenticationData().getUUID());
players.remove(player.getSocketAddress());

View file

@ -90,55 +90,40 @@ public class GeyserLogger implements org.geysermc.api.logger.Logger {
@Override
public void severe(String message) {
waitFor();
System.out.println(printConsole(ChatColor.DARK_RED + message, colored));
}
@Override
public void severe(String message, Throwable error) {
waitFor();
System.out.println(printConsole(ChatColor.DARK_RED + message + "\n" + error.getMessage(), colored));
}
@Override
public void error(String message) {
waitFor();
System.out.println(printConsole(ChatColor.RED + message, colored));
}
@Override
public void error(String message, Throwable error) {
waitFor();
System.out.println(printConsole(ChatColor.RED + message + "\n" + error, colored));
}
@Override
public void warning(String message) {
waitFor();
System.out.println(printConsole(ChatColor.YELLOW + message, colored));
}
@Override
public void info(String message) {
waitFor();
System.out.println(printConsole(ChatColor.WHITE + message, colored));
}
@Override
public void debug(String message) {
waitFor();
if (debug)
System.out.println(printConsole(ChatColor.GRAY + message, colored));
}
private synchronized void waitFor() {
}
public void stop() {
}
public static String printConsole(String message, boolean colors) {
return colors ? ChatColor.toANSI(message + ChatColor.RESET) : ChatColor.stripColors(message + ChatColor.RESET);
}

View file

@ -25,16 +25,15 @@
package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType;
import com.github.steveice10.mc.protocol.data.message.TextMessage;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityDataDictionary;
import com.nukkitx.protocol.bedrock.data.EntityFlag;
import com.nukkitx.protocol.bedrock.data.EntityFlags;
import com.nukkitx.protocol.bedrock.packet.AddEntityPacket;
import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket;
import com.nukkitx.protocol.bedrock.packet.*;
import lombok.Getter;
import lombok.Setter;
import org.geysermc.connector.console.GeyserLogger;
@ -43,6 +42,7 @@ import org.geysermc.connector.entity.attribute.AttributeType;
import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.utils.AttributeUtils;
import org.geysermc.connector.utils.MessageUtils;
import java.util.*;
@ -71,6 +71,7 @@ public class Entity {
protected Set<Long> passengers = new HashSet<>();
protected Map<AttributeType, Attribute> attributes = new HashMap<>();
protected EntityDataDictionary metadata = new EntityDataDictionary();
public Entity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
this.entityId = entityId;
@ -82,6 +83,20 @@ public class Entity {
this.valid = false;
this.movePending = false;
this.dimension = 0;
metadata.put(EntityData.SCALE, 1f);
metadata.put(EntityData.MAX_AIR, (short) 400);
metadata.put(EntityData.AIR, (short) 0);
metadata.put(EntityData.LEAD_HOLDER_EID, -1L);
metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight());
metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth());
EntityFlags flags = new EntityFlags();
flags.setFlag(EntityFlag.HAS_GRAVITY, true);
flags.setFlag(EntityFlag.HAS_COLLISION, true);
flags.setFlag(EntityFlag.CAN_SHOW_NAME, true);
flags.setFlag(EntityFlag.CAN_CLIMB, true);
metadata.putFlags(flags);
}
public void spawnEntity(GeyserSession session) {
@ -93,7 +108,7 @@ public class Entity {
addEntityPacket.setMotion(motion);
addEntityPacket.setRotation(getBedrockRotation());
addEntityPacket.setEntityType(entityType.getType());
addEntityPacket.getMetadata().putAll(getMetadata());
addEntityPacket.getMetadata().putAll(metadata);
valid = true;
session.getUpstream().sendPacket(addEntityPacket);
@ -132,27 +147,10 @@ public class Entity {
public void moveAbsolute(Vector3f position, Vector3f rotation) {
setPosition(position);
setRotation(rotation);
this.movePending = true;
}
public EntityDataDictionary getMetadata() {
EntityFlags flags = new EntityFlags();
flags.setFlag(EntityFlag.HAS_GRAVITY, true);
flags.setFlag(EntityFlag.HAS_COLLISION, true);
flags.setFlag(EntityFlag.CAN_SHOW_NAME, true);
flags.setFlag(EntityFlag.CAN_CLIMB, true);
EntityDataDictionary dictionary = new EntityDataDictionary();
dictionary.put(EntityData.SCALE, 1f);
dictionary.put(EntityData.MAX_AIR, (short) 400);
dictionary.put(EntityData.AIR, (short) 0);
dictionary.put(EntityData.LEAD_HOLDER_EID, -1L);
dictionary.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight());
dictionary.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth());
dictionary.putFlags(flags);
return dictionary;
}
public void updateBedrockAttributes(GeyserSession session) {
List<com.nukkitx.protocol.bedrock.data.Attribute> attributes = new ArrayList<>();
for (Map.Entry<AttributeType, Attribute> entry : this.attributes.entrySet()) {
@ -166,27 +164,43 @@ public class Entity {
updateAttributesPacket.setRuntimeEntityId(geyserId);
updateAttributesPacket.setAttributes(attributes);
session.getUpstream().sendPacket(updateAttributesPacket);
}
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
switch (entityMetadata.getId()) {
case 0:
if (entityMetadata.getType() == MetadataType.BYTE) {
byte xd = (byte) entityMetadata.getValue();
metadata.getFlags().setFlag(EntityFlag.ON_FIRE, (xd & 0x01) == 0x01);
metadata.getFlags().setFlag(EntityFlag.SNEAKING, (xd & 0x02) == 0x02);
metadata.getFlags().setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08);
metadata.getFlags().setFlag(EntityFlag.SWIMMING, (xd & 0x10) == 0x10);
metadata.getFlags().setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80);
metadata.getFlags().setFlag(EntityFlag.INVISIBLE, (xd & 0x20) == 0x20);
}
break;
case 2: // custom name
TextMessage name = (TextMessage) entityMetadata.getValue();
if (name != null)
metadata.put(EntityData.NAMETAG, MessageUtils.getBedrockMessage(name));
break;
case 3: // is custom name visible
metadata.getFlags().setFlag(EntityFlag.ALWAYS_SHOW_NAME, (boolean) entityMetadata.getValue());
break;
case 4: // silent
metadata.getFlags().setFlag(EntityFlag.SILENT, (boolean) entityMetadata.getValue());
break;
case 5: // no gravity
metadata.getFlags().setFlag(EntityFlag.HAS_GRAVITY, !(boolean) entityMetadata.getValue());
break;
}
SetEntityDataPacket entityDataPacket = new SetEntityDataPacket();
entityDataPacket.setRuntimeEntityId(geyserId);
entityDataPacket.getMetadata().putAll(getMetadata());
entityDataPacket.getMetadata().putAll(metadata);
session.getUpstream().sendPacket(entityDataPacket);
}
// To be used at a later date
public void updateJavaAttributes(GeyserSession session) {
List<com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute> attributes = new ArrayList<>();
for (Map.Entry<AttributeType, Attribute> entry : this.attributes.entrySet()) {
if (!entry.getValue().getType().isBedrockAttribute())
continue;
attributes.add(AttributeUtils.getJavaAttribute(entry.getValue()));
}
ServerEntityPropertiesPacket entityPropertiesPacket = new ServerEntityPropertiesPacket((int) entityId, attributes);
session.getDownstream().getSession().send(entityPropertiesPacket);
}
public void setPosition(Vector3f position) {
if (is(PlayerEntity.class)) {
this.position = position.add(0, entityType.getOffset(), 0);

View file

@ -0,0 +1,58 @@
/*
* 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;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket;
import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.TranslatorsInit;
public class ItemEntity extends Entity {
public ItemEntity(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() == 7) {
AddItemEntityPacket itemPacket = new AddItemEntityPacket();
itemPacket.setRuntimeEntityId(geyserId);
itemPacket.setPosition(position);
itemPacket.setMotion(motion);
itemPacket.setUniqueEntityId(geyserId);
itemPacket.setFromFishing(false);
itemPacket.getMetadata().putAll(metadata);
itemPacket.setItemInHand(TranslatorsInit.getItemTranslator().translateToBedrock((ItemStack) entityMetadata.getValue()));
session.getUpstream().sendPacket(itemPacket);
}
super.updateBedrockMetadata(entityMetadata, session);
}
}

View file

@ -1,3 +1,28 @@
/*
* 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;
import com.nukkitx.math.vector.Vector3f;

View file

@ -87,20 +87,20 @@ public enum EntityType {
TRIPOD_CAMERA(62, 0f),
PLAYER(63, 1.8f, 0.6f, 0.6f, 1.62f),
ITEM(64, 0.25f, 0.25f),
PRIMED_TNT(65, 0.98f, 0.98f),
TNT(65, 0.98f, 0.98f),
FALLING_BLOCK(66, 0.98f, 0.98f),
MOVING_BLOCK(67, 0f),
EXPERIENCE_BOTTLE(68, 0.25f, 0.25f),
EXPERIENCE_ORB(69, 0f),
EYE_OF_ENDER(70, 0f),
ENDER_CRYSTAL(71, 0f),
END_CRYSTAL(71, 0f),
FIREWORK_ROCKET(72, 0f),
TRIDENT(73, 0f),
TURTLE(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
SHULKER_BULLET(76, 0f),
FISHING_HOOK(77, 0f),
FISHING_BOBBER(77, 0f),
CHALKBOARD(78, 0f),
DRAGON_FIREBALL(79, 0f),
ARROW(80, 0.25f, 0.25f),
@ -108,7 +108,7 @@ public enum EntityType {
EGG(82, 0f),
PAINTING(83, 0f),
MINECART(84, 0f),
LARGE_FIREBALL(85, 0f),
FIREBALL(85, 0f),
SPLASH_POTION(86, 0f),
ENDER_PEARL(87, 0f),
LEASH_KNOT(88, 0f),
@ -135,7 +135,8 @@ public enum EntityType {
DROWNED(110, 1.95f, 0.6f),
TROPICAL_FISH(111, 0.6f, 0.6f),
COD(112, 0.25f, 0.5f),
PANDA(113, 1.25f, 1.125f, 1.825f);
PANDA(113, 1.25f, 1.125f, 1.825f),
FOX(121, 0.5f, 1.25f);
private final int type;
private final float height;

View file

@ -55,48 +55,45 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
@Override
public BedrockPong onQuery(InetSocketAddress inetSocketAddress) {
PingEvent pong = new PingEvent(inetSocketAddress);
GeyserLogger.DEFAULT.debug(inetSocketAddress + " has pinged you!");
GeyserConfiguration config = connector.getConfig();
pong.setEdition("MCPE");
pong.setGameType("Default");
pong.setNintendoLimited(false);
pong.setProtocolVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion());
pong.setVersion("1.12.0");
PingEvent pongEvent = new PingEvent(inetSocketAddress);
pongEvent.setEdition("MCPE");
pongEvent.setGameType("Default");
pongEvent.setNintendoLimited(false);
pongEvent.setProtocolVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion());
pongEvent.setVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
connector.getPluginManager().runEvent(pong);
connector.getPluginManager().runEvent(pongEvent);
if (connector.getConfig().isPingPassthrough()) {
ServerStatusInfo serverInfo = connector.getPassthroughThread().getInfo();
if (serverInfo != null) {
pong.setMotd(MessageUtils.getBedrockMessage(serverInfo.getDescription()));
pong.setSubMotd(config.getBedrock().getMotd2());
pong.setPlayerCount(serverInfo.getPlayerInfo().getOnlinePlayers());
pong.setMaximumPlayerCount(serverInfo.getPlayerInfo().getMaxPlayers());
pongEvent.setMotd(MessageUtils.getBedrockMessage(serverInfo.getDescription()));
pongEvent.setSubMotd(config.getBedrock().getMotd2());
pongEvent.setPlayerCount(serverInfo.getPlayerInfo().getOnlinePlayers());
pongEvent.setMaximumPlayerCount(serverInfo.getPlayerInfo().getMaxPlayers());
}
} else {
pong.setPlayerCount(1);
pong.setMaximumPlayerCount(config.getMaxPlayers());
pong.setMotd(config.getBedrock().getMotd1());
pong.setSubMotd(config.getBedrock().getMotd2());
pongEvent.setPlayerCount(1);
pongEvent.setMaximumPlayerCount(config.getMaxPlayers());
pongEvent.setMotd(config.getBedrock().getMotd1());
pongEvent.setSubMotd(config.getBedrock().getMotd2());
}
BedrockPong c = new BedrockPong();
c.setEdition(pong.getEdition());
c.setGameType(pong.getGameType());
c.setNintendoLimited(pong.isNintendoLimited());
c.setProtocolVersion(pong.getProtocolVersion());
c.setVersion(pong.getVersion());
c.setMotd(pong.getMotd());
c.setSubMotd(pong.getSubMotd());
c.setPlayerCount(pong.getPlayerCount());
c.setMaximumPlayerCount(pong.getMaximumPlayerCount());
c.setIpv4Port(config.getBedrock().getPort());
return c;
BedrockPong pong = new BedrockPong();
pong.setEdition(pongEvent.getEdition());
pong.setGameType(pongEvent.getGameType());
pong.setNintendoLimited(pongEvent.isNintendoLimited());
pong.setProtocolVersion(pongEvent.getProtocolVersion());
pong.setVersion(pongEvent.getVersion());
pong.setMotd(pongEvent.getMotd());
pong.setSubMotd(pongEvent.getSubMotd());
pong.setPlayerCount(pongEvent.getPlayerCount());
pong.setMaximumPlayerCount(pongEvent.getMaximumPlayerCount());
pong.setIpv4Port(config.getBedrock().getPort());
return pong;
}
@Override
@ -106,10 +103,15 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
bedrockServerSession.addDisconnectHandler(disconnectReason -> {
GeyserLogger.DEFAULT.info("Bedrock user with ip: " + bedrockServerSession.getAddress().getAddress() + " has disconnected for reason " + disconnectReason);
Player player = connector.getPlayers().get(bedrockServerSession.getAddress());
GeyserSession player = connector.getPlayers().get(bedrockServerSession.getAddress());
if (player != null) {
player.disconnect(disconnectReason.name());
connector.removePlayer(player);
player.getEntityCache().clear();
player.getInventoryCache().getInventories().clear();
player.getWindowCache().getWindows().clear();
player.getScoreboardCache().removeScoreboard();
}
});
bedrockServerSession.setPacketCodec(GeyserConnector.BEDROCK_PACKET_CODEC);

View file

@ -716,4 +716,49 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
public boolean handle(VideoStreamConnectPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(EmotePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(TickSyncPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(AnvilDamagePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(NetworkSettingsPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PlayerAuthInputPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(SettingsCommandPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(EducationSettingsPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(CompletedUsingItemPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(MultiplayerSettingsPacket packet) {
return defaultHandler(packet);
}
}

View file

@ -45,7 +45,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
@Override
public boolean handle(LoginPacket loginPacket) {
// TODO: Implement support for multiple protocols
if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
connector.getLogger().debug("unsupported");
session.getUpstream().disconnect("Unsupported Bedrock version. Are you running an outdated version?");
@ -56,16 +55,16 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
PlayStatusPacket playStatus = new PlayStatusPacket();
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
session.getUpstream().sendPacketImmediately(playStatus);
session.getUpstream().sendPacket(playStatus);
ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket();
session.getUpstream().sendPacketImmediately(resourcePacksInfo);
session.getUpstream().sendPacket(resourcePacksInfo);
return true;
}
@Override
public boolean handle(ResourcePackClientResponsePacket textPacket) {
switch (textPacket.getStatus()) {
public boolean handle(ResourcePackClientResponsePacket packet) {
switch (packet.getStatus()) {
case COMPLETED:
session.connect(connector.getRemoteServer());
connector.getLogger().info("Player connected with username " + session.getAuthenticationData().getName());
@ -74,7 +73,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
ResourcePackStackPacket stack = new ResourcePackStackPacket();
stack.setExperimental(false);
stack.setForcedToAccept(false);
session.getUpstream().sendPacketImmediately(stack);
stack.setGameVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
session.getUpstream().sendPacket(stack);
break;
default:
session.getUpstream().disconnect("disconnectionScreen.resourcePack");

View file

@ -28,7 +28,7 @@ package org.geysermc.connector.network.session;
import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.auth.exception.request.RequestException;
import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.packetlib.Client;
import com.github.steveice10.packetlib.event.session.ConnectedEvent;
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
@ -40,9 +40,14 @@ import com.nukkitx.math.vector.Vector2f;
import com.nukkitx.math.vector.Vector2i;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.protocol.bedrock.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
import com.nukkitx.protocol.bedrock.data.GameRule;
import com.nukkitx.protocol.bedrock.packet.AvailableEntityIdentifiersPacket;
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.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.packet.TextPacket;
@ -57,6 +62,7 @@ import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.inventory.PlayerInventory;
import org.geysermc.connector.network.session.cache.*;
import org.geysermc.connector.network.translators.Registry;
import org.geysermc.connector.network.translators.TranslatorsInit;
import org.geysermc.connector.utils.Toolbox;
import java.net.InetSocketAddress;
@ -95,9 +101,7 @@ public class GeyserSession implements Player {
private boolean closed;
@Setter
private Vector3i blockDiggingPos = Vector3i.ZERO;
@Setter
private BlockFace blockDiggingFace = BlockFace.DOWN;
private GameMode gameMode = GameMode.SURVIVAL;
public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession) {
this.connector = connector;
@ -121,19 +125,43 @@ public class GeyserSession implements Player {
}
public void connect(RemoteServer remoteServer) {
// This has to be sent first so the player actually joins
startGame();
this.remoteServer = remoteServer;
if (!(connector.getConfig().getRemote().getAuthType().hashCode() == "online".hashCode())) {
connector.getLogger().info("Attempting to login using offline mode... authentication is disabled.");
authenticate(authenticationData.getName());
}
Vector3f pos = Vector3f.ZERO;
int chunkX = pos.getFloorX() >> 4;
int chunkZ = pos.getFloorZ() >> 4;
NetworkChunkPublisherUpdatePacket chunkPublisherUpdatePacket = new NetworkChunkPublisherUpdatePacket();
chunkPublisherUpdatePacket.setPosition(pos.toInt());
chunkPublisherUpdatePacket.setRadius(renderDistance << 4);
upstream.sendPacket(chunkPublisherUpdatePacket);
LevelChunkPacket data = new LevelChunkPacket();
data.setChunkX(chunkX);
data.setChunkZ(chunkZ);
data.setSubChunksLength(0);
data.setData(TranslatorsInit.EMPTY_LEVEL_CHUNK_DATA);
upstream.sendPacket(data);
BiomeDefinitionListPacket biomePacket = new BiomeDefinitionListPacket();
biomePacket.setTag(CompoundTag.EMPTY);
upstream.sendPacket(biomePacket);
AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket();
entityPacket.setTag(CompoundTag.EMPTY);
upstream.sendPacket(entityPacket);
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
upstream.sendPacket(playStatusPacket);
}
public void authenticate(String username) {
authenticate(username, "");
connector.addPlayer(this);
}
public void authenticate(String username, String password) {
@ -182,6 +210,7 @@ public class GeyserSession implements Player {
});
downstream.getSession().connect();
connector.addPlayer(this);
} catch (RequestException ex) {
ex.printStackTrace();
}
@ -260,15 +289,15 @@ public class GeyserSession implements Player {
startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0));
startGamePacket.setRotation(Vector2f.from(1, 1));
startGamePacket.setSeed(0);
startGamePacket.setSeed(-1);
startGamePacket.setDimensionId(playerEntity.getDimension());
startGamePacket.setGeneratorId(1);
startGamePacket.setLevelGamemode(0);
startGamePacket.setDifficulty(1);
startGamePacket.setDefaultSpawn(Vector3i.ZERO);
startGamePacket.setAcheivementsDisabled(true);
startGamePacket.setTime(0);
startGamePacket.setEduLevel(false);
startGamePacket.setTime(-1);
startGamePacket.setEduEditionOffers(0);
startGamePacket.setEduFeaturesEnabled(false);
startGamePacket.setRainLevel(0);
startGamePacket.setLightningLevel(0);
@ -294,15 +323,13 @@ public class GeyserSession implements Player {
startGamePacket.setLevelId("world");
startGamePacket.setWorldName("world");
startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000");
startGamePacket.setCurrentTick(0);
// startGamePacket.setCurrentTick(0);
startGamePacket.setEnchantmentSeed(0);
startGamePacket.setMultiplayerCorrelationId("");
startGamePacket.setCachedPalette(Toolbox.CACHED_PALLETE.retainedDuplicate());
startGamePacket.setBlockPalette(Toolbox.BLOCKS);
startGamePacket.setItemEntries(Toolbox.ITEMS);
startGamePacket.setVanillaVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
// startGamePacket.setMovementServerAuthoritative(true);
upstream.sendPacket(startGamePacket);
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
upstream.sendPacket(playStatusPacket);
}
}

View file

@ -16,10 +16,16 @@ public class UpstreamSession {
private boolean initialized = false;
public void sendPacket(@NonNull BedrockPacket packet) {
if (isClosed())
return;
session.sendPacket(packet);
}
public void sendPacketImmediately(@NonNull BedrockPacket packet) {
if (isClosed())
return;
session.sendPacketImmediately(packet);
}

View file

@ -65,7 +65,7 @@ public class ChunkCache {
Chunk chunk = column.getChunks()[position.getY() >> 4];
Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ());
if (chunk != null) {
chunk.getBlocks().set(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ(), block);
chunk.set(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ(), block);
}
}
@ -78,7 +78,7 @@ public class ChunkCache {
Chunk chunk = column.getChunks()[position.getY() >> 4];
Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ());
if (chunk != null) {
BlockState blockState = chunk.getBlocks().get(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
BlockState blockState = chunk.get(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
return TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState);
}

View file

@ -117,4 +117,11 @@ public class EntityCache {
public long removeBossBar(UUID uuid) {
return bossbars.remove(uuid);
}
public void clear() {
entities = null;
entityIdTranslations = null;
playerEntities = null;
bossbars = null;
}
}

View file

@ -27,10 +27,7 @@ package org.geysermc.connector.network.translators;
import com.github.steveice10.mc.protocol.packet.ingame.server.*;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.*;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerActionAckPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.*;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.*;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
@ -114,6 +111,7 @@ public class TranslatorsInit {
Registry.registerJava(ServerEntityRotationPacket.class, new JavaEntityRotationTranslator());
Registry.registerJava(ServerEntityHeadLookPacket.class, new JavaEntityHeadLookTranslator());
Registry.registerJava(ServerEntityMetadataPacket.class, new JavaEntityMetadataTranslator());
Registry.registerJava(ServerEntityStatusPacket.class, new JavaEntityStatusTranslator());
Registry.registerJava(ServerBossBarPacket.class, new JavaBossBarTranslator());
Registry.registerJava(ServerSpawnExpOrbPacket.class, new JavaSpawnExpOrbTranslator());
@ -129,6 +127,9 @@ public class TranslatorsInit {
Registry.registerJava(ServerPlayerHealthPacket.class, new JavaPlayerHealthTranslator());
Registry.registerJava(ServerPlayerActionAckPacket.class, new JavaPlayerActionAckTranslator());
// FIXME: This translator messes with allowing flight in creative mode. Will need to be addressed later
// Registry.registerJava(ServerPlayerAbilitiesPacket.class, new JavaPlayerAbilitiesTranslator());
Registry.registerJava(ServerNotifyClientPacket.class, new JavaNotifyClientTranslator());
Registry.registerJava(ServerChunkDataPacket.class, new JavaChunkDataTranslator());
Registry.registerJava(ServerEntityDestroyPacket.class, new JavaEntityDestroyTranslator());
@ -141,6 +142,7 @@ public class TranslatorsInit {
Registry.registerJava(ServerTeamPacket.class, new JavaTeamTranslator());
Registry.registerJava(ServerBlockChangePacket.class, new JavaBlockChangeTranslator());
Registry.registerJava(ServerMultiBlockChangePacket.class, new JavaMultiBlockChangeTranslator());
Registry.registerJava(ServerUnloadChunkPacket.class, new JavaUnloadChunkTranslator());
Registry.registerJava(ServerOpenWindowPacket.class, new OpenWindowPacketTranslator());
@ -151,6 +153,7 @@ public class TranslatorsInit {
Registry.registerBedrock(MovePlayerPacket.class, new BedrockMovePlayerTranslator());
Registry.registerBedrock(PlayerActionPacket.class, new BedrockActionTranslator());
Registry.registerBedrock(SetLocalPlayerAsInitializedPacket.class, new BedrockPlayerInitializedTranslator());
Registry.registerBedrock(InteractPacket.class, new BedrockInteractTranslator());
Registry.registerBedrock(TextPacket.class, new BedrockTextTranslator());
itemTranslator = new ItemTranslator();

View file

@ -57,23 +57,23 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
break;
case START_GLIDE:
case STOP_GLIDE:
ClientPlayerStatePacket glidePacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getGeyserId(), PlayerState.START_ELYTRA_FLYING);
ClientPlayerStatePacket glidePacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.START_ELYTRA_FLYING);
session.getDownstream().getSession().send(glidePacket);
break;
case START_SNEAK:
ClientPlayerStatePacket startSneakPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getGeyserId(), PlayerState.START_SNEAKING);
ClientPlayerStatePacket startSneakPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.START_SNEAKING);
session.getDownstream().getSession().send(startSneakPacket);
break;
case STOP_SNEAK:
ClientPlayerStatePacket stopSneakPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getGeyserId(), PlayerState.STOP_SNEAKING);
ClientPlayerStatePacket stopSneakPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.STOP_SNEAKING);
session.getDownstream().getSession().send(stopSneakPacket);
break;
case START_SPRINT:
ClientPlayerStatePacket startSprintPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getGeyserId(), PlayerState.START_SPRINTING);
ClientPlayerStatePacket startSprintPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.START_SPRINTING);
session.getDownstream().getSession().send(startSprintPacket);
break;
case STOP_SPRINT:
ClientPlayerStatePacket stopSprintPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getGeyserId(), PlayerState.STOP_SPRINTING);
ClientPlayerStatePacket stopSprintPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.STOP_SPRINTING);
session.getDownstream().getSession().send(stopSprintPacket);
break;
case DROP_ITEM:
@ -81,7 +81,7 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
session.getDownstream().getSession().send(dropItemPacket);
break;
case STOP_SLEEP:
ClientPlayerStatePacket stopSleepingPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getGeyserId(), PlayerState.LEAVE_BED);
ClientPlayerStatePacket stopSleepingPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.LEAVE_BED);
session.getDownstream().getSession().send(stopSleepingPacket);
break;
case BLOCK_INTERACT:
@ -93,12 +93,9 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
case START_BREAK:
ClientPlayerActionPacket startBreakingPacket = new ClientPlayerActionPacket(PlayerAction.START_DIGGING, new Position(packet.getBlockPosition().getX(),
packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()), BlockFace.values()[packet.getFace()]);
session.setBlockDiggingPos(packet.getBlockPosition());
session.setBlockDiggingFace(BlockFace.values()[packet.getFace()]);
session.getDownstream().getSession().send(startBreakingPacket);
break;
case CONTINUE_BREAK:
session.setBlockDiggingFace(BlockFace.values()[packet.getFace()]);
break;
case ABORT_BREAK:
ClientPlayerActionPacket abortBreakingPacket = new ClientPlayerActionPacket(PlayerAction.CANCEL_DIGGING, new Position(packet.getBlockPosition().getX(),
@ -106,10 +103,7 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
session.getDownstream().getSession().send(abortBreakingPacket);
break;
case STOP_BREAK:
Vector3i pos = session.getBlockDiggingPos();
ClientPlayerActionPacket stopBreakingPacket = new ClientPlayerActionPacket(PlayerAction.FINISH_DIGGING, new Position(pos.getX(),
pos.getY(), pos.getZ()), session.getBlockDiggingFace());
session.getDownstream().getSession().send(stopBreakingPacket);
// Handled in BedrockInventoryTransactionTranslator
break;
}
}

View file

@ -39,6 +39,7 @@ public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
case SWING_ARM:
ClientPlayerSwingArmPacket swingArmPacket = new ClientPlayerSwingArmPacket(Hand.MAIN_HAND);
session.getDownstream().getSession().send(swingArmPacket);
break;
}
}
}

View file

@ -30,6 +30,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.InteractPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@ -37,18 +39,21 @@ public class BedrockInteractTranslator extends PacketTranslator<InteractPacket>
@Override
public void translate(InteractPacket packet, GeyserSession session) {
Vector3f vector = packet.getMousePosition();
InteractAction action;
Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId());
if (entity == null)
return;
if(packet.getAction() == 1) {
action = InteractAction.ATTACK;
} else {
action = InteractAction.INTERACT;
switch (packet.getAction()) {
case 1:
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
InteractAction.INTERACT, Hand.MAIN_HAND);
session.getDownstream().getSession().send(interactPacket);
break;
case 2:
ClientPlayerInteractEntityPacket attackPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
InteractAction.ATTACK, Hand.MAIN_HAND);
session.getDownstream().getSession().send(attackPacket);
break;
}
ClientPlayerInteractEntityPacket entityPacket = new ClientPlayerInteractEntityPacket((int) packet.getRuntimeEntityId(),
action, vector.getX(), vector.getY(), vector.getZ(), Hand.MAIN_HAND);
session.getDownstream().getSession().send(entityPacket);
}
}

View file

@ -26,6 +26,7 @@
package org.geysermc.connector.network.translators.bedrock;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
@ -35,6 +36,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.InventoryTransactionPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@ -47,6 +49,11 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
if (packet.getActionType() == 1) {
ClientPlayerUseItemPacket useItemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND);
session.getDownstream().getSession().send(useItemPacket);
} else if (packet.getActionType() == 2) {
PlayerAction action = session.getGameMode() == GameMode.CREATIVE ? PlayerAction.START_DIGGING : PlayerAction.FINISH_DIGGING;
Position pos = new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ());
ClientPlayerActionPacket breakPacket = new ClientPlayerActionPacket(action, pos, BlockFace.values()[packet.getFace()]);
session.getDownstream().getSession().send(breakPacket);
}
break;
case ITEM_RELEASE:
@ -56,19 +63,16 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
}
break;
case ITEM_USE_ON_ENTITY:
Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId());
if (entity == null)
return;
Vector3f vector = packet.getClickPosition();
InteractAction action;
if(packet.getActionType() == 1) {
action = InteractAction.ATTACK;
} else {
action = InteractAction.INTERACT;
}
ClientPlayerInteractEntityPacket entityPacket = new ClientPlayerInteractEntityPacket((int) packet.getRuntimeEntityId(),
action, vector.getX(), vector.getY(), vector.getZ(), Hand.MAIN_HAND);
ClientPlayerInteractEntityPacket entityPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
InteractAction.values()[packet.getActionType()], vector.getX(), vector.getY(), vector.getZ(), Hand.MAIN_HAND);
session.getDownstream().getSession().send(entityPacket);
break;
}
}
}

View file

@ -25,26 +25,25 @@
package org.geysermc.connector.network.translators.bedrock;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import org.geysermc.api.ChatColor;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.block.BlockEntry;
public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPacket> {
@Override
public void translate(MovePlayerPacket packet, GeyserSession session) {
PlayerEntity entity = session.getPlayerEntity();
if (entity == null || !session.isSpawned()) return;
// can cause invalid moves when packet queue is not empty
if (!session.getUpstream().isInitialized()) {
MoveEntityAbsolutePacket moveEntityBack = new MoveEntityAbsolutePacket();
moveEntityBack.setRuntimeEntityId(entity.getGeyserId());
@ -57,7 +56,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
}
if (!isValidMove(session, packet.getMode(), entity.getPosition(), packet.getPosition())) {
session.getConnector().getLogger().info("Recalculating position...");
session.getConnector().getLogger().debug("Recalculating position...");
recalculatePosition(session, entity, entity.getPosition());
return;
}
@ -74,6 +73,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
entity.moveAbsolute(packet.getPosition().sub(0, EntityType.PLAYER.getOffset(), 0), rotation);
/*
boolean colliding = false;
Position position = new Position((int) packet.getPosition().getX(),
(int) Math.ceil(javaY * 2) / 2, (int) packet.getPosition().getZ());
@ -83,7 +83,8 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
colliding = true;
if (!colliding)
session.getDownstream().getSession().send(playerPositionRotationPacket);
*/
session.getDownstream().getSession().send(playerPositionRotationPacket);
}
public boolean isValidMove(GeyserSession session, MovePlayerPacket.Mode mode, Vector3f currentPosition, Vector3f newPosition) {
@ -102,7 +103,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
zRange = -zRange;
if ((xRange + yRange + zRange) > 100) {
session.getConnector().getLogger().warning(session.getName() + " moved too quickly." +
session.getConnector().getLogger().debug(ChatColor.RED + session.getName() + " moved too quickly." +
" current position: " + currentPosition + ", new position: " + newPosition);
return false;
@ -122,7 +123,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
movePlayerPacket.setRuntimeEntityId(entity.getGeyserId());
movePlayerPacket.setPosition(entity.getPosition());
movePlayerPacket.setRotation(entity.getBedrockRotation());
movePlayerPacket.setMode(MovePlayerPacket.Mode.NORMAL);
movePlayerPacket.setMode(MovePlayerPacket.Mode.RESET);
movePlayerPacket.setOnGround(true);
entity.setMovePending(false);
session.getUpstream().sendPacket(movePlayerPacket);

View file

@ -15,7 +15,6 @@ public class BedrockPlayerInitializedTranslator extends PacketTranslator<SetLoca
for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) {
if (!entity.isValid()) {
entity.sendPlayer(session);
// async skin loading
SkinUtils.requestAndHandleSkinAndCape(entity, session, skinAndCape -> entity.sendPlayer(session));
}

View file

@ -1,18 +1,11 @@
package org.geysermc.connector.network.translators.block;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.utils.Toolbox;
public class BlockTranslator {
public BlockEntry getBedrockBlock(BlockState state) {
BlockEntry bedrockItem = Toolbox.BLOCK_ENTRIES.get(state.getId());
if (bedrockItem == null) {
GeyserLogger.DEFAULT.debug("Missing mapping for java block " + state.getId() + "/nPlease report this to Geyser.");
return Toolbox.BLOCK_ENTRIES.get(10); // so we can walk and not getting stuck x)
}
return bedrockItem;
return Toolbox.BLOCK_ENTRIES.get(state.getId());
}
}

View file

@ -68,20 +68,14 @@ public class ItemTranslator {
}
ItemEntry bedrockItem = getItem(stack);
if (stack.getNBT() == null) {
if (stack.getNbt() == null) {
return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount());
}
return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount(), translateToBedrockNBT(stack.getNBT()));
return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount(), translateToBedrockNBT(stack.getNbt()));
}
public ItemEntry getItem(ItemStack stack) {
ItemEntry item = Toolbox.ITEM_ENTRIES.get(stack.getId());
if (item == null) {
GeyserLogger.DEFAULT.debug("Missing mapping for java item " + stack.getId());
return ItemEntry.AIR;
}
return item;
return Toolbox.ITEM_ENTRIES.get(stack.getId());
}
public ItemEntry getItem(ItemData data) {

View file

@ -14,11 +14,11 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
@Override
public void translate(ServerBossBarPacket packet, GeyserSession session) {
BossEventPacket bossEventPacket = new BossEventPacket();
bossEventPacket.setBossUniqueEntityId(session.getEntityCache().getBossBar(packet.getUUID()));
bossEventPacket.setBossUniqueEntityId(session.getEntityCache().getBossBar(packet.getUuid()));
switch (packet.getAction()) {
case ADD:
long entityId = session.getEntityCache().addBossBar(packet.getUUID());
long entityId = session.getEntityCache().addBossBar(packet.getUuid());
addBossEntity(session, entityId);
bossEventPacket.setType(BossEventPacket.Type.SHOW);
@ -39,7 +39,7 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
break;
case REMOVE:
bossEventPacket.setType(BossEventPacket.Type.HIDE);
removeBossEntity(session, session.getEntityCache().removeBossBar(packet.getUUID()));
removeBossEntity(session, session.getEntityCache().removeBossBar(packet.getUuid()));
break;
case UPDATE_STYLE:
case UPDATE_FLAGS:

View file

@ -26,10 +26,17 @@
package org.geysermc.connector.network.translators.java;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import com.nukkitx.protocol.bedrock.packet.*;
import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
import com.nukkitx.protocol.bedrock.packet.ChunkRadiusUpdatedPacket;
import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.world.chunk.ChunkPosition;
public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacket> {
@ -38,20 +45,19 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
AdventureSettingsPacket bedrockPacket = new AdventureSettingsPacket();
bedrockPacket.setUniqueEntityId(session.getPlayerEntity().getGeyserId());
bedrockPacket.setPlayerPermission(1);
session.getUpstream().sendPacketImmediately(bedrockPacket);
session.getUpstream().sendPacket(bedrockPacket);
PlayStatusPacket playStatus = new PlayStatusPacket();
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
session.getUpstream().sendPacketImmediately(playStatus);
// session.getUpstream().sendPacket(playStatus);
PlayerEntity entity = session.getPlayerEntity();
if (entity == null) return;
session.getPlayerEntity().setEntityId(packet.getEntityId());
entity.setEntityId(packet.getEntityId());
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
playerGameTypePacket.setGamemode(packet.getGameMode().ordinal());
session.getUpstream().sendPacket(playerGameTypePacket);
session.setGameMode(packet.getGameMode());
SetEntityDataPacket entityDataPacket = new SetEntityDataPacket();
entityDataPacket.setRuntimeEntityId(entity.getGeyserId());
@ -59,12 +65,11 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
session.getUpstream().sendPacket(entityDataPacket);
session.setRenderDistance(packet.getViewDistance() + 1); // +1 to be sure it includes every chunk
System.out.println(session.getRenderDistance());
if (session.getRenderDistance() > 32) session.setRenderDistance(32); // <3 u ViaVersion but I don't like crashing clients x)
ChunkRadiusUpdatedPacket packet1 = new ChunkRadiusUpdatedPacket();
packet1.setRadius(session.getRenderDistance());
session.getUpstream().sendPacket(packet1);
ChunkRadiusUpdatedPacket chunkRadiusPacket = new ChunkRadiusUpdatedPacket();
chunkRadiusPacket.setRadius(session.getRenderDistance());
session.getUpstream().sendPacket(chunkRadiusPacket);
session.setSpawned(true);
}

View file

@ -26,7 +26,9 @@
package org.geysermc.connector.network.translators.java;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket;
import com.nukkitx.protocol.bedrock.packet.ChangeDimensionPacket;
import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@ -39,10 +41,37 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
if (entity == null)
return;
if (entity.getDimension() == packet.getDimension()) {
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
session.getUpstream().sendPacket(playStatusPacket);
if (entity.getDimension() == getDimension(packet.getDimension()))
return;
entity.setDimension(getDimension(packet.getDimension()));
ChangeDimensionPacket changeDimensionPacket = new ChangeDimensionPacket();
changeDimensionPacket.setDimension(getDimension(packet.getDimension()));
changeDimensionPacket.setRespawn(false);
changeDimensionPacket.setPosition(entity.getPosition());
session.getUpstream().sendPacket(changeDimensionPacket);
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
playerGameTypePacket.setGamemode(packet.getGamemode().ordinal());
session.getUpstream().sendPacket(playerGameTypePacket);
session.setGameMode(packet.getGamemode());
/*
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
session.getUpstream().sendPacket(playStatusPacket);
*/
}
private int getDimension(int javaDimension) {
switch (javaDimension) {
case -1:
return 1;
case 1:
return 2;
}
return javaDimension;
}
}

View file

@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket;
import com.nukkitx.protocol.bedrock.packet.SetTitlePacket;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.utils.MessageUtils;
public class JavaTitleTranslator extends PacketTranslator<ServerTitlePacket> {
@ -39,11 +40,11 @@ public class JavaTitleTranslator extends PacketTranslator<ServerTitlePacket> {
switch (packet.getAction()) {
case TITLE:
titlePacket.setType(SetTitlePacket.Type.SET_TITLE);
titlePacket.setText(packet.getTitle().getFullText());
titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle()));
break;
case SUBTITLE:
titlePacket.setType(SetTitlePacket.Type.SET_SUBTITLE);
titlePacket.setText(packet.getSubtitle().getFullText());
titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle()));
break;
case CLEAR:
case RESET:
@ -52,7 +53,7 @@ public class JavaTitleTranslator extends PacketTranslator<ServerTitlePacket> {
break;
case ACTION_BAR:
titlePacket.setType(SetTitlePacket.Type.SET_ACTIONBAR_MESSAGE);
titlePacket.setText(packet.getActionBar().getFullText());
titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle()));
break;
case TIMES:
titlePacket.setFadeInTime(packet.getFadeIn());

View file

@ -25,8 +25,8 @@
package org.geysermc.connector.network.translators.java.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@ -42,12 +42,9 @@ public class JavaEntityMetadataTranslator extends PacketTranslator<ServerEntityM
if (entity == null) return;
if (entity.isValid()) {
// TODO: Make this actually useful lol
SetEntityDataPacket entityDataPacket = new SetEntityDataPacket();
entityDataPacket.setRuntimeEntityId(entity.getGeyserId());
entityDataPacket.getMetadata().putAll(entity.getMetadata());
session.getUpstream().sendPacket(entityDataPacket);
for (EntityMetadata metadata : packet.getMetadata()) {
entity.updateBedrockMetadata(metadata, session);
}
} else {
entity.spawnEntity(session);
}

View file

@ -41,7 +41,7 @@ public class JavaEntityPositionRotationTranslator extends PacketTranslator<Serve
}
if (entity == null) return;
entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), packet.getYaw(), packet.getPitch());
entity.moveRelative(packet.getMoveX(), packet.getMoveY(), packet.getMoveZ(), packet.getYaw(), packet.getPitch());
if (entity.isMovePending()) {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();

View file

@ -41,7 +41,7 @@ public class JavaEntityPositionTranslator extends PacketTranslator<ServerEntityP
}
if (entity == null) return;
entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), entity.getRotation());
entity.moveRelative(packet.getMoveX(), packet.getMoveY(), packet.getMoveZ(), entity.getRotation());
if (entity.isMovePending()) {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();

View file

@ -31,6 +31,7 @@ import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.attribute.AttributeType;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.utils.AttributeUtils;
public class JavaEntityPropertiesTranslator extends PacketTranslator<ServerEntityPropertiesPacket> {
@ -45,23 +46,23 @@ public class JavaEntityPropertiesTranslator extends PacketTranslator<ServerEntit
for (Attribute attribute : packet.getAttributes()) {
switch (attribute.getType()) {
case GENERIC_MAX_HEALTH:
entity.getAttributes().put(AttributeType.MAX_HEALTH, AttributeType.MAX_HEALTH.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.MAX_HEALTH, AttributeType.MAX_HEALTH.getAttribute((float) AttributeUtils.calculateValue(attribute)));
break;
case GENERIC_ATTACK_DAMAGE:
entity.getAttributes().put(AttributeType.ATTACK_DAMAGE, AttributeType.ATTACK_DAMAGE.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.ATTACK_DAMAGE, AttributeType.ATTACK_DAMAGE.getAttribute((float) AttributeUtils.calculateValue(attribute)));
break;
case GENERIC_FLYING_SPEED:
entity.getAttributes().put(AttributeType.FLYING_SPEED, AttributeType.FLYING_SPEED.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.MOVEMENT_SPEED, AttributeType.MOVEMENT_SPEED.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.FLYING_SPEED, AttributeType.FLYING_SPEED.getAttribute((float) AttributeUtils.calculateValue(attribute)));
entity.getAttributes().put(AttributeType.MOVEMENT_SPEED, AttributeType.MOVEMENT_SPEED.getAttribute((float) AttributeUtils.calculateValue(attribute)));
break;
case GENERIC_MOVEMENT_SPEED:
entity.getAttributes().put(AttributeType.MOVEMENT_SPEED, AttributeType.MOVEMENT_SPEED.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.MOVEMENT_SPEED, AttributeType.MOVEMENT_SPEED.getAttribute((float) AttributeUtils.calculateValue(attribute)));
break;
case GENERIC_FOLLOW_RANGE:
entity.getAttributes().put(AttributeType.FOLLOW_RANGE, AttributeType.FOLLOW_RANGE.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.FOLLOW_RANGE, AttributeType.FOLLOW_RANGE.getAttribute((float) AttributeUtils.calculateValue(attribute)));
break;
case GENERIC_KNOCKBACK_RESISTANCE:
entity.getAttributes().put(AttributeType.KNOCKBACK_RESISTANCE, AttributeType.KNOCKBACK_RESISTANCE.getAttribute((float) attribute.getValue()));
entity.getAttributes().put(AttributeType.KNOCKBACK_RESISTANCE, AttributeType.KNOCKBACK_RESISTANCE.getAttribute((float) AttributeUtils.calculateValue(attribute)));
break;
}
}

View file

@ -26,6 +26,7 @@
package org.geysermc.connector.network.translators.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
@ -41,7 +42,8 @@ public class JavaEntityRotationTranslator extends PacketTranslator<ServerEntityR
}
if (entity == null) return;
entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), packet.getYaw(), packet.getPitch());
// entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), packet.getYaw(), packet.getPitch());
entity.setRotation(Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw()));
if (entity.isMovePending()) {
MoveEntityAbsolutePacket moveEntityAbsolutePacket = new MoveEntityAbsolutePacket();

View file

@ -0,0 +1,97 @@
/*
* 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.network.translators.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
@Override
public void translate(ServerEntityStatusPacket packet, GeyserSession session) {
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
entity = session.getPlayerEntity();
}
if (entity == null)
return;
EntityEventPacket entityEventPacket = new EntityEventPacket();
entityEventPacket.setRuntimeEntityId(entity.getGeyserId());
switch (packet.getStatus()) {
case LIVING_HURT:
case LIVING_HURT_SWEET_BERRY_BUSH:
entityEventPacket.setEvent(EntityEventPacket.Event.HURT_ANIMATION);
break;
case LIVING_DEATH:
entityEventPacket.setEvent(EntityEventPacket.Event.DEATH_ANIMATION);
break;
case WOLF_SHAKE_WATER:
entityEventPacket.setEvent(EntityEventPacket.Event.SHAKE_WET);
break;
case PLAYER_FINISH_USING_ITEM:
entityEventPacket.setEvent(EntityEventPacket.Event.USE_ITEM);
break;
case FISHING_HOOK_PULL_PLAYER:
entityEventPacket.setEvent(EntityEventPacket.Event.FISH_HOOK_LURED);
break;
case TAMEABLE_TAMING_FAILED:
entityEventPacket.setEvent(EntityEventPacket.Event.TAME_FAIL);
break;
case TAMEABLE_TAMING_SUCCEEDED:
entityEventPacket.setEvent(EntityEventPacket.Event.TAME_SUCCESS);
case ZOMBIE_VILLAGER_CURE:
entityEventPacket.setEvent(EntityEventPacket.Event.ZOMBIE_VILLAGER_CURE);
break;
case ANIMAL_EMIT_HEARTS:
entityEventPacket.setEvent(EntityEventPacket.Event.LOVE_PARTICLES);
break;
case FIREWORK_EXPLODE:
entityEventPacket.setEvent(EntityEventPacket.Event.FIREWORK_PARTICLES);
break;
case WITCH_EMIT_PARTICLES:
entityEventPacket.setEvent(EntityEventPacket.Event.WITCH_SPELL_PARTICLES);
break;
case TOTEM_OF_UNDYING_MAKE_SOUND:
entityEventPacket.setEvent(EntityEventPacket.Event.CONSUME_TOTEM);
break;
case SHEEP_GRAZE_OR_TNT_CART_EXPLODE:
entityEventPacket.setEvent(EntityEventPacket.Event.MINECART_TNT_PRIME_FUSE);
break;
case IRON_GOLEM_HOLD_POPPY:
entityEventPacket.setEvent(EntityEventPacket.Event.IRON_GOLEM_OFFER_FLOWER);
break;
case IRON_GOLEM_EMPTY_HAND:
entityEventPacket.setEvent(EntityEventPacket.Event.IRON_GOLEM_WITHDRAW_FLOWER);
break;
}
session.getUpstream().sendPacket(entityEventPacket);
}
}

View file

@ -0,0 +1,73 @@
/*
* 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.network.translators.java.entity.player;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket;
import com.nukkitx.protocol.bedrock.data.EntityDataDictionary;
import com.nukkitx.protocol.bedrock.data.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
public class JavaPlayerAbilitiesTranslator extends PacketTranslator<ServerPlayerAbilitiesPacket> {
@Override
public void translate(ServerPlayerAbilitiesPacket packet, GeyserSession session) {
Entity entity = session.getPlayerEntity();
if (entity == null)
return;
EntityDataDictionary metadata = entity.getMetadata();
metadata.getFlags().setFlag(EntityFlag.CAN_FLY, packet.isCanFly());
SetEntityDataPacket entityDataPacket = new SetEntityDataPacket();
entityDataPacket.setRuntimeEntityId(entity.getGeyserId());
entityDataPacket.getMetadata().putAll(metadata);
session.getUpstream().sendPacket(entityDataPacket);
int playerFlags = 0;
playerFlags = setPlayerFlag(0x20, true, playerFlags); // auto jump
playerFlags = setPlayerFlag(0x40, packet.isCanFly(), playerFlags); // can fly
playerFlags = setPlayerFlag(0x200, packet.isFlying(), playerFlags); // is flying
AdventureSettingsPacket adventureSettingsPacket = new AdventureSettingsPacket();
adventureSettingsPacket.setPlayerPermission(1);
adventureSettingsPacket.setUniqueEntityId(entity.getGeyserId());
adventureSettingsPacket.setPlayerFlags(playerFlags);
session.getUpstream().sendPacket(adventureSettingsPacket);
}
private int setPlayerFlag(int flag, boolean value, int playerFlags) {
if (value) {
return playerFlags | flag;
} else {
return playerFlags & ~flag;
}
}
}

View file

@ -61,8 +61,10 @@ public class JavaPlayerHealthTranslator extends PacketTranslator<ServerPlayerHea
if (packet.getHealth() <= 0) {
RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(entity.getGeyserId());
respawnPacket.setPosition(Vector3f.from(0, 72, 0));
session.getUpstream().sendPacket(new RespawnPacket());
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_SEARCHING);
session.getUpstream().sendPacket(respawnPacket);
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
session.getDownstream().getSession().send(javaRespawnPacket);

View file

@ -39,7 +39,7 @@ public class JavaPlayerSetExperienceTranslator extends PacketTranslator<ServerPl
if (entity == null)
return;
entity.getAttributes().put(AttributeType.EXPERIENCE, AttributeType.EXPERIENCE.getAttribute(packet.getSlot()));
entity.getAttributes().put(AttributeType.EXPERIENCE, AttributeType.EXPERIENCE.getAttribute(packet.getExperience()));
entity.getAttributes().put(AttributeType.EXPERIENCE_LEVEL, AttributeType.EXPERIENCE_LEVEL.getAttribute(packet.getLevel()));
entity.updateBedrockAttributes(session);
}

View file

@ -41,9 +41,9 @@ public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlaye
Vector3f position = Vector3f.from(packet.getX(), packet.getY() - EntityType.PLAYER.getOffset(), packet.getZ());
Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw());
PlayerEntity entity = session.getEntityCache().getPlayerEntity(packet.getUUID());
PlayerEntity entity = session.getEntityCache().getPlayerEntity(packet.getUuid());
if (entity == null) {
Geyser.getLogger().error("Haven't received PlayerListEntry packet before spawning player! We ignore the player " + packet.getUUID());
Geyser.getLogger().error("Haven't received PlayerListEntry packet before spawning player! We ignore the player " + packet.getUuid());
return;
}
@ -51,8 +51,9 @@ public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlaye
entity.setPosition(position);
entity.setRotation(rotation);
entity.sendPlayer(session);
// async skin loading
SkinUtils.requestAndHandleSkinAndCape(entity, session, skinAndCape -> entity.sendPlayer(session));
if (session.getUpstream().isInitialized()) {
SkinUtils.requestAndHandleSkinAndCape(entity, session, skinAndCape -> entity.sendPlayer(session));
}
}
}

View file

@ -34,7 +34,7 @@ public class JavaDisplayScoreboardTranslator extends PacketTranslator<ServerDisp
@Override
public void translate(ServerDisplayScoreboardPacket packet, GeyserSession session) {
session.getScoreboardCache().getScoreboard().registerNewObjective(
packet.getScoreboardName(), packet.getPosition()
packet.getName(), packet.getPosition()
);
}
}

View file

@ -63,7 +63,6 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
levelChunkPacket.setChunkZ(packet.getColumn().getZ());
levelChunkPacket.setData(payload);
session.getUpstream().sendPacket(levelChunkPacket);
session.getChunkCache().addToCache(packet.getColumn());
} catch (Exception ex) {
ex.printStackTrace();
}

View file

@ -28,9 +28,9 @@ package org.geysermc.connector.network.translators.java.world;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket;
import com.nukkitx.protocol.bedrock.data.EntityDataDictionary;
import com.nukkitx.protocol.bedrock.data.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.*;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@ -41,6 +41,10 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
@Override
public void translate(ServerNotifyClientPacket packet, GeyserSession session) {
Entity entity = session.getPlayerEntity();
if (entity == null)
return;
switch (packet.getNotification()) {
case START_RAIN:
LevelEventPacket startRainPacket = new LevelEventPacket();
@ -57,16 +61,35 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
session.getUpstream().sendPacket(stopRainPacket);
break;
case CHANGE_GAMEMODE:
int gamemode = ((GameMode) packet.getValue()).ordinal();
int playerFlags = 0;
GameMode gameMode = (GameMode) packet.getValue();
playerFlags = setPlayerFlag(0x01, gameMode == GameMode.ADVENTURE, playerFlags); // world immutable
playerFlags = setPlayerFlag(0x20, true, playerFlags); // auto jump
playerFlags = setPlayerFlag(0x40, gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR, playerFlags); // can fly
playerFlags = setPlayerFlag(0x80, gameMode == GameMode.SPECTATOR, playerFlags); // no clip
playerFlags = setPlayerFlag(0x200, gameMode == GameMode.SPECTATOR, playerFlags); // is flying
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
playerGameTypePacket.setGamemode(gamemode);
playerGameTypePacket.setGamemode(gameMode.ordinal());
session.getUpstream().sendPacket(playerGameTypePacket);
session.setGameMode(gameMode);
AdventureSettingsPacket adventureSettingsPacket = new AdventureSettingsPacket();
adventureSettingsPacket.setPlayerPermission(1);
adventureSettingsPacket.setUniqueEntityId(entity.getGeyserId());
adventureSettingsPacket.setPlayerFlags(playerFlags);
session.getUpstream().sendPacket(adventureSettingsPacket);
EntityDataDictionary metadata = entity.getMetadata();
metadata.getFlags().setFlag(EntityFlag.CAN_FLY, gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR);
SetEntityDataPacket entityDataPacket = new SetEntityDataPacket();
entityDataPacket.setRuntimeEntityId(entity.getGeyserId());
entityDataPacket.getMetadata().putAll(metadata);
session.getUpstream().sendPacket(entityDataPacket);
break;
case ENTER_CREDITS:
Entity entity = session.getPlayerEntity();
if (entity == null)
return;
ShowCreditsPacket showCreditsPacket = new ShowCreditsPacket();
showCreditsPacket.setStatus(ShowCreditsPacket.Status.START_CREDITS);
showCreditsPacket.setRuntimeEntityId(entity.getGeyserId());
@ -76,4 +99,12 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
break;
}
}
private int setPlayerFlag(int flag, boolean value, int playerFlags) {
if (value) {
return playerFlags | flag;
} else {
return playerFlags & ~flag;
}
}
}

View file

@ -0,0 +1,39 @@
/*
* 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.network.translators.java.world;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUnloadChunkPacket;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.world.chunk.ChunkPosition;
public class JavaUnloadChunkTranslator extends PacketTranslator<ServerUnloadChunkPacket> {
@Override
public void translate(ServerUnloadChunkPacket packet, GeyserSession session) {
session.getChunkCache().removeChunk(new ChunkPosition(packet.getX(), packet.getZ()));
}
}

View file

@ -1,5 +1,7 @@
package org.geysermc.connector.utils;
import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeModifier;
import com.github.steveice10.mc.protocol.data.game.entity.attribute.ModifierOperation;
import org.geysermc.connector.entity.attribute.Attribute;
import org.geysermc.connector.entity.attribute.AttributeType;
@ -42,4 +44,26 @@ public class AttributeUtils {
return new com.nukkitx.protocol.bedrock.data.Attribute(type.getBedrockIdentifier(), attribute.getMinimum(), attribute.getMaximum(), attribute.getValue(), attribute.getDefaultValue());
}
//https://minecraft.gamepedia.com/Attribute#Modifiers
public static double calculateValue(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute attribute) {
double base = attribute.getValue();
for (AttributeModifier modifier : attribute.getModifiers()) {
if (modifier.getOperation() == ModifierOperation.ADD) {
base += modifier.getAmount();
}
}
double value = base;
for (AttributeModifier modifier : attribute.getModifiers()) {
if (modifier.getOperation() == ModifierOperation.ADD_MULTIPLIED) {
value += base * modifier.getAmount();
}
}
for (AttributeModifier modifier : attribute.getModifiers()) {
if (modifier.getOperation() == ModifierOperation.MULTIPLY) {
value *= 1.0D + modifier.getAmount();
}
}
return value;
}
}

View file

@ -1,12 +0,0 @@
package org.geysermc.connector.utils;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor(access = AccessLevel.PUBLIC)
@Getter
public class BiValue<F, S> {
private F f;
private S s;
}

View file

@ -1,6 +1,5 @@
package org.geysermc.connector.utils;
import com.github.steveice10.mc.protocol.data.game.chunk.BlockStorage;
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
import com.github.steveice10.mc.protocol.data.game.chunk.Column;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
@ -16,23 +15,20 @@ public class ChunkUtils {
Chunk[] chunks = column.getChunks();
int chunkSectionCount = chunks.length;
chunkData.sections = new ChunkSection[chunkSectionCount];
for (int i = 0; i < chunkSectionCount; i++) {
chunkData.sections[i] = new ChunkSection();
}
for (int chunkY = 0; chunkY < chunkSectionCount; chunkY++) {
chunkData.sections[chunkY] = new ChunkSection();
Chunk chunk = chunks[chunkY];
if (chunk == null || chunk.isEmpty())
continue;
BlockStorage storage = chunk.getBlocks();
ChunkSection section = chunkData.sections[chunkY];
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
BlockState blockState = storage.get(x, y, z);
BlockState blockState = chunk.get(x, y, z);
BlockEntry block = TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState);
section.getBlockStorageArray()[0].setFullBlock(ChunkSection.blockPosition(x, y, z),

View file

@ -19,10 +19,10 @@ public class ProvidedSkin {
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
int rgba = image.getRGB(x, y);
outputStream.write((rgba >> 16) & 0xFF);
outputStream.write((rgba >> 8) & 0xFF);
outputStream.write(rgba & 0xFF);
outputStream.write((rgba >> 24) & 0xFF);
outputStream.write((rgba >> 16) & 0xFF); // Red
outputStream.write((rgba >> 8) & 0xFF); // Green
outputStream.write(rgba & 0xFF); // Blue
outputStream.write((rgba >> 24) & 0xFF); // Alpha
}
}
image.flush();

View file

@ -22,12 +22,12 @@ public class SkinProvider {
public static final boolean ALLOW_THIRD_PARTY_CAPES = ((GeyserConnector)Geyser.getConnector()).getConfig().isAllowThirdPartyCapes();
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(ALLOW_THIRD_PARTY_CAPES ? 21 : 14);
public static final Skin EMPTY_SKIN = new Skin(-1, "");
public static final byte[] STEVE_SKIN = new ProvidedSkin("bedrock/skin/skin_steve.png").getSkin();
public static final Skin EMPTY_SKIN = new Skin(-1, "steve", STEVE_SKIN);
private static Map<UUID, Skin> cachedSkins = new ConcurrentHashMap<>();
private static Map<UUID, CompletableFuture<Skin>> requestedSkins = new ConcurrentHashMap<>();
public static final Cape EMPTY_CAPE = new Cape("", new byte[0], -1, true);
public static final Cape EMPTY_CAPE = new Cape("", "no-cape", new byte[0], -1, true);
private static Map<String, Cape> cachedCapes = new ConcurrentHashMap<>();
private static Map<String, CompletableFuture<Cape>> requestedCapes = new ConcurrentHashMap<>();
@ -149,8 +149,11 @@ public class SkinProvider {
cape = requestImage(capeUrl, true);
} catch (Exception ignored) {} // just ignore I guess
String[] urlSection = capeUrl.split("/"); // A real url is expected at this stage
return new Cape(
capeUrl,
urlSection[urlSection.length - 1], // get the texture id and use it as cape id
cape.length > 0 ? cape : EMPTY_CAPE.getCapeData(),
System.currentTimeMillis(),
cape.length == 0
@ -209,13 +212,14 @@ public class SkinProvider {
public static class Skin {
private UUID skinOwner;
private String textureUrl;
private byte[] skinData = STEVE_SKIN;
private byte[] skinData;
private long requestedOn;
private boolean updated;
private Skin(long requestedOn, String textureUrl) {
private Skin(long requestedOn, String textureUrl, byte[] skinData) {
this.requestedOn = requestedOn;
this.textureUrl = textureUrl;
this.skinData = skinData;
}
}
@ -223,6 +227,7 @@ public class SkinProvider {
@Getter
public static class Cape {
private String textureUrl;
private String capeId;
private byte[] capeData;
private long requestedOn;
private boolean failed;

View file

@ -2,21 +2,26 @@ package org.geysermc.connector.utils;
import com.github.steveice10.mc.auth.data.GameProfile;
import com.google.gson.JsonObject;
import com.nukkitx.protocol.bedrock.data.ImageData;
import com.nukkitx.protocol.bedrock.data.SerializedSkin;
import com.nukkitx.protocol.bedrock.packet.PlayerListPacket;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.codec.Charsets;
import org.geysermc.api.Geyser;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.network.session.GeyserSession;
import java.util.Base64;
import java.util.Collections;
import java.util.UUID;
import java.util.function.Consumer;
public class SkinUtils {
public static PlayerListPacket.Entry buildCachedEntry(GameProfile profile, long geyserId) {
GameProfileData data = GameProfileData.from(profile);
SkinProvider.Cape cape = SkinProvider.getCachedCape(data.getCapeUrl());
return buildEntryManually(
profile.getId(),
@ -24,8 +29,9 @@ public class SkinUtils {
geyserId,
profile.getIdAsString(),
SkinProvider.getCachedSkin(profile.getId()).getSkinData(),
SkinProvider.getCachedCape(data.getCapeUrl()).getCapeData(),
"geometry.humanoid.custom" + (data.isAlex() ? "Slim" : ""),
cape.getCapeId(),
cape.getCapeData(),
getLegacySkinGeometry("geometry.humanoid.custom" + (data.isAlex() ? "Slim" : "")),
""
);
}
@ -37,25 +43,29 @@ public class SkinUtils {
geyserId,
profile.getIdAsString(),
SkinProvider.STEVE_SKIN,
SkinProvider.EMPTY_CAPE.getCapeId(),
SkinProvider.EMPTY_CAPE.getCapeData(),
"geometry.humanoid",
getLegacySkinGeometry("geometry.humanoid"),
""
);
}
public static PlayerListPacket.Entry buildEntryManually(UUID uuid, String username, long geyserId,
String skinId, byte[] skinData, byte[] capeData,
String skinId, byte[] skinData,
String capeId, byte[] capeData,
String geometryName, String geometryData) {
SerializedSkin serializedSkin = SerializedSkin.of(
skinId, geometryName, ImageData.of(skinData), Collections.emptyList(),
ImageData.of(capeData), geometryData, "", true, false, false, capeId, uuid.toString()
);
PlayerListPacket.Entry entry = new PlayerListPacket.Entry(uuid);
entry.setName(username);
entry.setEntityId(geyserId);
entry.setSkinId(skinId);
entry.setSkinData(skinData != null ? skinData : SkinProvider.STEVE_SKIN);
entry.setCapeData(capeData);
entry.setGeometryName(geometryName);
entry.setGeometryData(geometryData);
entry.setSkin(serializedSkin);
entry.setXuid("");
entry.setPlatformChatId("");
entry.setTeacher(false);
return entry;
}
@ -86,9 +96,11 @@ public class SkinUtils {
return new GameProfileData(skinUrl, capeUrl, isAlex);
} catch (Exception exception) {
if (!((GeyserConnector) Geyser.getConnector()).getConfig().getRemote().getAuthType().equals("offline")) {
Geyser.getLogger().debug("Got invalid texture data for " + profile.getName() + " " + exception.getMessage());
}
// return default skin with default cape when texture data is invalid
Geyser.getLogger().debug("Got invalid texture data for " + profile.getName() + " " + exception.getMessage());
return new GameProfileData("", "", false);
return new GameProfileData(SkinProvider.EMPTY_SKIN.getTextureUrl(), SkinProvider.EMPTY_CAPE.getTextureUrl(), false);
}
}
}
@ -96,7 +108,7 @@ public class SkinUtils {
public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSession session,
Consumer<SkinProvider.SkinAndCape> skinAndCapeConsumer) {
Geyser.getGeneralThreadPool().execute(() -> {
SkinUtils.GameProfileData data = SkinUtils.GameProfileData.from(entity.getProfile());
GameProfileData data = GameProfileData.from(entity.getProfile());
SkinProvider.requestSkinAndCape(entity.getUuid(), data.getSkinUrl(), data.getCapeUrl())
.whenCompleteAsync((skinAndCape, throwable) -> {
@ -115,14 +127,15 @@ public class SkinUtils {
entity.setLastSkinUpdate(skin.getRequestedOn());
if (session.getUpstream().isInitialized()) {
PlayerListPacket.Entry updatedEntry = SkinUtils.buildEntryManually(
PlayerListPacket.Entry updatedEntry = buildEntryManually(
entity.getUuid(),
entity.getUsername(),
entity.getGeyserId(),
entity.getUuid().toString(),
skin.getSkinData(),
cape.getCapeId(),
cape.getCapeData(),
"geometry.humanoid.custom" + (data.isAlex() ? "Slim" : ""),
getLegacySkinGeometry("geometry.humanoid.custom" + (data.isAlex() ? "Slim" : "")),
""
);
@ -145,4 +158,8 @@ public class SkinUtils {
});
});
}
private static String getLegacySkinGeometry(String geometryName) {
return "{\"geometry\" :{\"default\" :\"" + geometryName + "\"}}";
}
}

View file

@ -1,13 +1,15 @@
package org.geysermc.connector.utils;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.nukkitx.network.VarInts;
import com.nukkitx.nbt.NbtUtils;
import com.nukkitx.nbt.stream.NBTInputStream;
import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.nbt.tag.ListTag;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.v361.BedrockUtils;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.network.translators.block.BlockEntry;
import org.geysermc.connector.network.translators.item.ItemEntry;
@ -18,39 +20,40 @@ import java.util.*;
public class Toolbox {
public static final Collection<StartGamePacket.ItemEntry> ITEMS;
public static final ByteBuf CACHED_PALLETE;
public static final Collection<StartGamePacket.ItemEntry> ITEMS = new ArrayList<>();
public static ListTag<CompoundTag> BLOCKS;
public static final TIntObjectMap<ItemEntry> ITEM_ENTRIES;
public static final TIntObjectMap<BlockEntry> BLOCK_ENTRIES;
public static final TIntObjectMap<ItemEntry> ITEM_ENTRIES = new TIntObjectHashMap<>();
public static final TIntObjectMap<BlockEntry> BLOCK_ENTRIES = new TIntObjectHashMap<>();
static {
InputStream stream = Toolbox.class.getClassLoader().getResourceAsStream("bedrock/cached_palette.json");
ObjectMapper mapper = new ObjectMapper();
List<LinkedHashMap<String, Object>> entries = new ArrayList<>();
try {
entries = mapper.readValue(stream, ArrayList.class);
} catch (Exception e) {
e.printStackTrace();
public static void init() {
InputStream stream = GeyserConnector.class.getClassLoader().getResourceAsStream("bedrock/runtime_block_states.dat");
if (stream == null) {
throw new AssertionError("Unable to find bedrock/runtime_block_states.dat");
}
ByteBuf cachedPalette = Unpooled.buffer();
VarInts.writeUnsignedInt(cachedPalette, entries.size());
Map<String, Integer> blockIdToIdentifier = new HashMap<>();
ListTag<CompoundTag> blocksTag;
for (Map<String, Object> entry : entries) {
blockIdToIdentifier.put((String) entry.get("name"), (int) entry.get("id"));
GlobalBlockPalette.registerMapping((int) entry.get("id") << 4 | (int) entry.get("data"));
BedrockUtils.writeString(cachedPalette, (String) entry.get("name"));
cachedPalette.writeShortLE((int) entry.get("data"));
cachedPalette.writeShortLE((int) entry.get("id"));
NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream);
try {
blocksTag = (ListTag<CompoundTag>) nbtInputStream.readTag();
nbtInputStream.close();
} catch (Exception ex) {
GeyserLogger.DEFAULT.warning("Failed to get blocks from runtime block states, please report this error!");
throw new AssertionError(ex);
}
CACHED_PALLETE = cachedPalette;
for (CompoundTag entry : blocksTag.getValue()) {
String name = entry.getAsCompound("block").getAsString("name");
int id = entry.getAsShort("id");
int data = entry.getAsShort("meta");
blockIdToIdentifier.put(name, id);
GlobalBlockPalette.registerMapping(id << 4 | data);
}
BLOCKS = blocksTag;
InputStream stream2 = Toolbox.class.getClassLoader().getResourceAsStream("bedrock/items.json");
if (stream2 == null) {
throw new AssertionError("Items Table not found");
@ -64,13 +67,10 @@ public class Toolbox {
e.printStackTrace();
}
List<StartGamePacket.ItemEntry> startGameEntries = new ArrayList<>();
for (Map entry : startGameItems) {
startGameEntries.add(new StartGamePacket.ItemEntry((String) entry.get("name"), (short) ((int) entry.get("id"))));
ITEMS.add(new StartGamePacket.ItemEntry((String) entry.get("name"), (short) ((int) entry.get("id"))));
}
ITEMS = startGameEntries;
InputStream itemStream = Toolbox.class.getClassLoader().getResourceAsStream("items.json");
ObjectMapper itemMapper = new ObjectMapper();
Map<String, Map<String, Object>> items = new HashMap<>();
@ -81,16 +81,12 @@ public class Toolbox {
ex.printStackTrace();
}
TIntObjectMap<ItemEntry> itemEntries = new TIntObjectHashMap<>();
int itemIndex = 0;
for (Map.Entry<String, Map<String, Object>> itemEntry : items.entrySet()) {
itemEntries.put(itemIndex, new ItemEntry(itemEntry.getKey(), itemIndex, (int) itemEntry.getValue().get("bedrock_id"), (int) itemEntry.getValue().get("bedrock_data")));
ITEM_ENTRIES.put(itemIndex, new ItemEntry(itemEntry.getKey(), itemIndex, (int) itemEntry.getValue().get("bedrock_id"), (int) itemEntry.getValue().get("bedrock_data")));
itemIndex++;
}
ITEM_ENTRIES = itemEntries;
InputStream blockStream = Toolbox.class.getClassLoader().getResourceAsStream("blocks.json");
ObjectMapper blockMapper = new ObjectMapper();
Map<String, Map<String, Object>> blocks = new HashMap<>();
@ -101,20 +97,16 @@ public class Toolbox {
ex.printStackTrace();
}
TIntObjectMap<BlockEntry> blockEntries = new TIntObjectHashMap<>();
int blockIndex = 0;
for (Map.Entry<String, Map<String, Object>> itemEntry : blocks.entrySet()) {
if (!blockIdToIdentifier.containsKey(itemEntry.getValue().get("bedrock_identifier"))) {
GeyserLogger.DEFAULT.debug("Mapping " + itemEntry.getValue().get("bedrock_identifier") + " does not exist on bedrock edition!");
blockEntries.put(blockIndex, new BlockEntry(itemEntry.getKey(), blockIndex, 248, 0)); // update block
GeyserLogger.DEFAULT.debug("Mapping " + itemEntry.getValue().get("bedrock_identifier") + " was not found for bedrock edition!");
BLOCK_ENTRIES.put(blockIndex, new BlockEntry(itemEntry.getKey(), blockIndex, 248, 0)); // update block
} else {
blockEntries.put(blockIndex, new BlockEntry(itemEntry.getKey(), blockIndex, blockIdToIdentifier.get(itemEntry.getValue().get("bedrock_identifier")), (int) itemEntry.getValue().get("bedrock_data")));
BLOCK_ENTRIES.put(blockIndex, new BlockEntry(itemEntry.getKey(), blockIndex, blockIdToIdentifier.get(itemEntry.getValue().get("bedrock_identifier")), (int) itemEntry.getValue().get("bedrock_data")));
}
blockIndex++;
}
BLOCK_ENTRIES = blockEntries;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1039,6 +1039,9 @@
{
"id" : 2
},
{
"id" : 198
},
{
"id" : 243
},
@ -1336,6 +1339,26 @@
"id" : -131,
"damage" : 4
},
{
"id" : -131,
"damage" : 11
},
{
"id" : -131,
"damage" : 9
},
{
"id" : -131,
"damage" : 10
},
{
"id" : -131,
"damage" : 8
},
{
"id" : -131,
"damage" : 12
},
{
"id" : -133,
"damage" : 3
@ -1441,6 +1464,9 @@
"id" : 175,
"damage" : 5
},
{
"id" : -216
},
{
"id" : 351,
"damage" : 19
@ -1748,6 +1774,10 @@
"id" : 383,
"damage" : 113
},
{
"id" : 383,
"damage" : 121
},
{
"id" : 383,
"damage" : 33
@ -2993,15 +3023,15 @@
{
"id" : 54
},
{
"id" : -203
},
{
"id" : 146
},
{
"id" : 130
},
{
"id" : -203
},
{
"id" : 205
},
@ -3819,32 +3849,25 @@
"id" : 69
},
{
"id" : 143,
"damage" : 5
"id" : 143
},
{
"id" : -144,
"damage" : 5
"id" : -144
},
{
"id" : -141,
"damage" : 5
"id" : -141
},
{
"id" : -143,
"damage" : 5
"id" : -143
},
{
"id" : -140,
"damage" : 5
"id" : -140
},
{
"id" : -142,
"damage" : 5
"id" : -142
},
{
"id" : 77,
"damage" : 5
"id" : 77
},
{
"id" : 131

View file

@ -51,6 +51,10 @@
"name": "minecraft:bread",
"id": 297
},
{
"name": "minecraft:light_block",
"id": -215
},
{
"name": "minecraft:porkchop",
"id": 319
@ -63,10 +67,18 @@
"name": "minecraft:fish",
"id": 349
},
{
"name": "minecraft:element_52",
"id": -63
},
{
"name": "minecraft:diamond_sword",
"id": 276
},
{
"name": "minecraft:element_38",
"id": -49
},
{
"name": "minecraft:sandstone_stairs",
"id": 128
@ -87,6 +99,10 @@
"name": "minecraft:horsearmorgold",
"id": 418
},
{
"name": "minecraft:element_74",
"id": -85
},
{
"name": "minecraft:pufferfish",
"id": 462
@ -107,6 +123,10 @@
"name": "minecraft:emerald",
"id": 388
},
{
"name": "minecraft:element_47",
"id": -58
},
{
"name": "minecraft:mushroom_stew",
"id": 282
@ -135,10 +155,22 @@
"name": "minecraft:cooked_fish",
"id": 350
},
{
"name": "minecraft:element_32",
"id": -43
},
{
"name": "minecraft:double_stone_slab4",
"id": -166
},
{
"name": "minecraft:element_5",
"id": -16
},
{
"name": "minecraft:element_25",
"id": -36
},
{
"name": "minecraft:polished_granite_stairs",
"id": -172
@ -159,10 +191,18 @@
"name": "minecraft:cooked_salmon",
"id": 463
},
{
"name": "minecraft:element_87",
"id": -98
},
{
"name": "minecraft:pumpkin_seeds",
"id": 361
},
{
"name": "minecraft:element_53",
"id": -64
},
{
"name": "minecraft:dried_kelp",
"id": 464
@ -219,6 +259,10 @@
"name": "minecraft:chicken",
"id": 365
},
{
"name": "minecraft:element_31",
"id": -42
},
{
"name": "minecraft:cooked_chicken",
"id": 366
@ -243,6 +287,10 @@
"name": "minecraft:diamond_axe",
"id": 279
},
{
"name": "minecraft:element_105",
"id": -116
},
{
"name": "minecraft:carrot",
"id": 391
@ -259,6 +307,10 @@
"name": "minecraft:baked_potato",
"id": 393
},
{
"name": "minecraft:element_15",
"id": -26
},
{
"name": "minecraft:carpet",
"id": 171
@ -367,6 +419,10 @@
"name": "minecraft:arrow",
"id": 262
},
{
"name": "minecraft:element_97",
"id": -108
},
{
"name": "minecraft:campfire",
"id": 720
@ -463,6 +519,10 @@
"name": "minecraft:slime_ball",
"id": 341
},
{
"name": "minecraft:element_58",
"id": -69
},
{
"name": "minecraft:golden_sword",
"id": 283
@ -483,6 +543,10 @@
"name": "minecraft:golden_axe",
"id": 286
},
{
"name": "minecraft:element_62",
"id": -73
},
{
"name": "minecraft:string",
"id": 287
@ -551,14 +615,26 @@
"name": "minecraft:grindstone",
"id": -195
},
{
"name": "minecraft:element_46",
"id": -57
},
{
"name": "minecraft:potion",
"id": 373
},
{
"name": "minecraft:wither_rose",
"id": -216
},
{
"name": "minecraft:leather_helmet",
"id": 298
},
{
"name": "minecraft:element_48",
"id": -59
},
{
"name": "minecraft:leather_chestplate",
"id": 299
@ -587,6 +663,14 @@
"name": "minecraft:stonebrick",
"id": 98
},
{
"name": "minecraft:stickypistonarmcollision",
"id": -217
},
{
"name": "minecraft:structure_void",
"id": 217
},
{
"name": "minecraft:chainmail_chestplate",
"id": 303
@ -595,6 +679,10 @@
"name": "minecraft:lit_blast_furnace",
"id": -214
},
{
"name": "minecraft:element_11",
"id": -22
},
{
"name": "minecraft:chainmail_leggings",
"id": 304
@ -631,6 +719,10 @@
"name": "minecraft:iron_boots",
"id": 309
},
{
"name": "minecraft:element_104",
"id": -115
},
{
"name": "minecraft:chorus_fruit_popped",
"id": 433
@ -643,6 +735,10 @@
"name": "minecraft:diamond_leggings",
"id": 312
},
{
"name": "minecraft:element_75",
"id": -86
},
{
"name": "minecraft:diamond_boots",
"id": 313
@ -787,6 +883,10 @@
"name": "minecraft:flowing_lava",
"id": 10
},
{
"name": "minecraft:element_86",
"id": -97
},
{
"name": "minecraft:red_glazed_terracotta",
"id": 234
@ -831,6 +931,10 @@
"name": "minecraft:clock",
"id": 347
},
{
"name": "minecraft:element_96",
"id": -107
},
{
"name": "minecraft:dye",
"id": 351
@ -859,6 +963,10 @@
"name": "minecraft:cake",
"id": 354
},
{
"name": "minecraft:element_113",
"id": -124
},
{
"name": "minecraft:mossy_cobblestone",
"id": 48
@ -891,6 +999,14 @@
"name": "minecraft:double_stone_slab2",
"id": 182
},
{
"name": "minecraft:element_3",
"id": -14
},
{
"name": "minecraft:element_23",
"id": -34
},
{
"name": "minecraft:skull",
"id": 397
@ -939,6 +1055,10 @@
"name": "minecraft:fermented_spider_eye",
"id": 376
},
{
"name": "minecraft:element_81",
"id": -92
},
{
"name": "minecraft:monster_egg",
"id": 97
@ -1019,10 +1139,18 @@
"name": "minecraft:netherstar",
"id": 399
},
{
"name": "minecraft:element_16",
"id": -27
},
{
"name": "minecraft:fireworks",
"id": 401
},
{
"name": "minecraft:element_30",
"id": -41
},
{
"name": "minecraft:fireworkscharge",
"id": 402
@ -1047,6 +1175,10 @@
"name": "minecraft:concrete",
"id": 236
},
{
"name": "minecraft:element_73",
"id": -84
},
{
"name": "minecraft:quartz",
"id": 406
@ -1059,10 +1191,18 @@
"name": "minecraft:leaves2",
"id": 161
},
{
"name": "minecraft:element_102",
"id": -113
},
{
"name": "minecraft:coral_fan_hang2",
"id": -136
},
{
"name": "minecraft:element_67",
"id": -78
},
{
"name": "minecraft:hopper_minecart",
"id": 408
@ -1107,13 +1247,17 @@
"name": "minecraft:record_13",
"id": 500
},
{
"name": "minecraft:stone_button",
"id": 77
},
{
"name": "minecraft:record_cat",
"id": 501
},
{
"name": "minecraft:stone_button",
"id": 77
"name": "minecraft:element_89",
"id": -100
},
{
"name": "minecraft:record_blocks",
@ -1123,6 +1267,10 @@
"name": "minecraft:bamboo",
"id": -163
},
{
"name": "minecraft:element_72",
"id": -83
},
{
"name": "minecraft:record_chirp",
"id": 503
@ -1187,6 +1335,10 @@
"name": "minecraft:end_crystal",
"id": 426
},
{
"name": "minecraft:element_55",
"id": -66
},
{
"name": "minecraft:birch_door",
"id": 428
@ -1203,6 +1355,10 @@
"name": "minecraft:acacia_door",
"id": 430
},
{
"name": "minecraft:element_116",
"id": -127
},
{
"name": "minecraft:chorus_fruit",
"id": 432
@ -1251,6 +1407,10 @@
"name": "minecraft:prismarine_shard",
"id": 409
},
{
"name": "minecraft:element_112",
"id": -123
},
{
"name": "minecraft:totem",
"id": 450
@ -1263,6 +1423,10 @@
"name": "minecraft:pumpkin_stem",
"id": 104
},
{
"name": "minecraft:element_50",
"id": -61
},
{
"name": "minecraft:lever",
"id": 69
@ -1271,6 +1435,10 @@
"name": "minecraft:heart_of_the_sea",
"id": 467
},
{
"name": "minecraft:element_92",
"id": -103
},
{
"name": "minecraft:grass",
"id": 2
@ -1323,6 +1491,22 @@
"name": "minecraft:banner_pattern",
"id": 434
},
{
"name": "minecraft:suspicious_stew",
"id": 734
},
{
"name": "minecraft:element_4",
"id": -15
},
{
"name": "minecraft:element_24",
"id": -35
},
{
"name": "minecraft:camera",
"id": 498
},
{
"name": "minecraft:compound",
"id": 499
@ -1331,6 +1515,10 @@
"name": "minecraft:bleach",
"id": 451
},
{
"name": "minecraft:element_40",
"id": -51
},
{
"name": "minecraft:rapid_fertilizer",
"id": 449
@ -1399,6 +1587,10 @@
"name": "minecraft:coral_block",
"id": -132
},
{
"name": "minecraft:element_54",
"id": -65
},
{
"name": "minecraft:double_stone_slab",
"id": 44
@ -1407,6 +1599,14 @@
"name": "minecraft:double_stone_slab3",
"id": -162
},
{
"name": "minecraft:element_2",
"id": -13
},
{
"name": "minecraft:element_22",
"id": -33
},
{
"name": "minecraft:real_double_stone_slab2",
"id": 181
@ -1423,6 +1623,10 @@
"name": "minecraft:leaves",
"id": 18
},
{
"name": "minecraft:element_10",
"id": -21
},
{
"name": "minecraft:birch_button",
"id": -141
@ -1435,6 +1639,10 @@
"name": "minecraft:red_sandstone",
"id": 179
},
{
"name": "minecraft:element_91",
"id": -102
},
{
"name": "minecraft:wooden_slab",
"id": 158
@ -1463,10 +1671,6 @@
"name": "minecraft:planks",
"id": 5
},
{
"name": "minecraft:redstone_torch",
"id": 76
},
{
"name": "minecraft:quartz_block",
"id": 155
@ -1511,6 +1715,10 @@
"name": "minecraft:stained_glass",
"id": 241
},
{
"name": "minecraft:element_82",
"id": -93
},
{
"name": "minecraft:stained_glass_pane",
"id": 160
@ -1523,6 +1731,10 @@
"name": "minecraft:undyed_shulker_box",
"id": 205
},
{
"name": "minecraft:element_107",
"id": -118
},
{
"name": "minecraft:piston",
"id": 33
@ -1567,6 +1779,10 @@
"name": "minecraft:bell",
"id": -206
},
{
"name": "minecraft:element_42",
"id": -53
},
{
"name": "minecraft:cartography_table",
"id": -200
@ -1587,6 +1803,10 @@
"name": "minecraft:chemistry_table",
"id": 238
},
{
"name": "minecraft:element_70",
"id": -81
},
{
"name": "minecraft:tnt",
"id": 46
@ -1603,54 +1823,214 @@
"name": "minecraft:brown_mushroom",
"id": 39
},
{
"name": "minecraft:element_0",
"id": 36
},
{
"name": "minecraft:element_20",
"id": -31
},
{
"name": "minecraft:element_1",
"id": -12
},
{
"name": "minecraft:element_21",
"id": -32
},
{
"name": "minecraft:element_6",
"id": -17
},
{
"name": "minecraft:element_26",
"id": -37
},
{
"name": "minecraft:element_7",
"id": -18
},
{
"name": "minecraft:element_27",
"id": -38
},
{
"name": "minecraft:element_8",
"id": -19
},
{
"name": "minecraft:element_28",
"id": -39
},
{
"name": "minecraft:dark_oak_pressure_plate",
"id": -152
},
{
"name": "minecraft:element_9",
"id": -20
},
{
"name": "minecraft:element_29",
"id": -40
},
{
"name": "minecraft:item.spruce_door",
"id": 193
},
{
"name": "minecraft:element_12",
"id": -23
},
{
"name": "minecraft:cyan_glazed_terracotta",
"id": 229
},
{
"name": "minecraft:element_13",
"id": -24
},
{
"name": "minecraft:element_14",
"id": -25
},
{
"name": "minecraft:iron_ore",
"id": 15
},
{
"name": "minecraft:element_17",
"id": -28
},
{
"name": "minecraft:element_18",
"id": -29
},
{
"name": "minecraft:birch_pressure_plate",
"id": -151
},
{
"name": "minecraft:element_19",
"id": -30
},
{
"name": "minecraft:wooden_pressure_plate",
"id": 72
},
{
"name": "minecraft:element_33",
"id": -44
},
{
"name": "minecraft:element_34",
"id": -45
},
{
"name": "minecraft:element_35",
"id": -46
},
{
"name": "minecraft:composter",
"id": -213
},
{
"name": "minecraft:element_36",
"id": -47
},
{
"name": "minecraft:element_37",
"id": -48
},
{
"name": "minecraft:element_39",
"id": -50
},
{
"name": "minecraft:element_41",
"id": -52
},
{
"name": "minecraft:hay_block",
"id": 170
},
{
"name": "minecraft:element_43",
"id": -54
},
{
"name": "minecraft:lit_redstone_lamp",
"id": 124
},
{
"name": "minecraft:element_44",
"id": -55
},
{
"name": "minecraft:element_45",
"id": -56
},
{
"name": "minecraft:element_49",
"id": -60
},
{
"name": "minecraft:element_51",
"id": -62
},
{
"name": "minecraft:element_56",
"id": -67
},
{
"name": "minecraft:element_57",
"id": -68
},
{
"name": "minecraft:element_59",
"id": -70
},
{
"name": "minecraft:element_60",
"id": -71
},
{
"name": "minecraft:dropper",
"id": 125
},
{
"name": "minecraft:element_61",
"id": -72
},
{
"name": "minecraft:element_63",
"id": -74
},
{
"name": "minecraft:element_64",
"id": -75
},
{
"name": "minecraft:element_65",
"id": -76
},
{
"name": "minecraft:coral_fan_hang3",
"id": -137
},
{
"name": "minecraft:element_66",
"id": -77
},
{
"name": "minecraft:redstone_lamp",
"id": 123
},
{
"name": "minecraft:element_68",
"id": -79
},
{
"name": "minecraft:spruce_trapdoor",
"id": -149
@ -1659,18 +2039,54 @@
"name": "minecraft:purple_glazed_terracotta",
"id": 219
},
{
"name": "minecraft:element_69",
"id": -80
},
{
"name": "minecraft:iron_block",
"id": 42
},
{
"name": "minecraft:element_71",
"id": -82
},
{
"name": "minecraft:element_76",
"id": -87
},
{
"name": "minecraft:element_77",
"id": -88
},
{
"name": "minecraft:water",
"id": 9
},
{
"name": "minecraft:element_78",
"id": -89
},
{
"name": "minecraft:element_79",
"id": -90
},
{
"name": "minecraft:element_80",
"id": -91
},
{
"name": "minecraft:netherreactor",
"id": 247
},
{
"name": "minecraft:element_83",
"id": -94
},
{
"name": "minecraft:element_84",
"id": -95
},
{
"name": "minecraft:jungle_wall_sign",
"id": -189
@ -1679,6 +2095,18 @@
"name": "minecraft:end_brick_stairs",
"id": -178
},
{
"name": "minecraft:element_85",
"id": -96
},
{
"name": "minecraft:element_88",
"id": -99
},
{
"name": "minecraft:element_90",
"id": -101
},
{
"name": "minecraft:birch_standing_sign",
"id": -186
@ -1687,6 +2115,18 @@
"name": "minecraft:gold_ore",
"id": 14
},
{
"name": "minecraft:element_93",
"id": -104
},
{
"name": "minecraft:element_94",
"id": -105
},
{
"name": "minecraft:element_95",
"id": -106
},
{
"name": "minecraft:glass",
"id": 20
@ -1695,10 +2135,62 @@
"name": "minecraft:red_nether_brick",
"id": 215
},
{
"name": "minecraft:element_98",
"id": -109
},
{
"name": "minecraft:element_99",
"id": -110
},
{
"name": "minecraft:element_100",
"id": -111
},
{
"name": "minecraft:element_101",
"id": -112
},
{
"name": "minecraft:element_103",
"id": -114
},
{
"name": "minecraft:element_106",
"id": -117
},
{
"name": "minecraft:element_108",
"id": -119
},
{
"name": "minecraft:element_109",
"id": -120
},
{
"name": "minecraft:element_110",
"id": -121
},
{
"name": "minecraft:element_111",
"id": -122
},
{
"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
},
{
"name": "minecraft:slime",
"id": 165
@ -1707,6 +2199,10 @@
"name": "minecraft:spruce_standing_sign",
"id": -181
},
{
"name": "minecraft:element_118",
"id": -129
},
{
"name": "minecraft:gravel",
"id": 13
@ -1855,6 +2351,10 @@
"name": "minecraft:red_nether_brick_stairs",
"id": -184
},
{
"name": "minecraft:redstone_torch",
"id": 76
},
{
"name": "minecraft:ice",
"id": 79
@ -2179,6 +2679,14 @@
"name": "minecraft:chorus_plant",
"id": 240
},
{
"name": "minecraft:fire",
"id": 51
},
{
"name": "minecraft:item.camera",
"id": 242
},
{
"name": "minecraft:stonecutter",
"id": 245
@ -2203,10 +2711,6 @@
"name": "minecraft:stripped_dark_oak_log",
"id": -9
},
{
"name": "minecraft:fire",
"id": 51
},
{
"name": "minecraft:hard_glass_pane",
"id": 190

View file

@ -432,76 +432,76 @@
"bedrock_data": 2
},
"minecraft:oak_wood[axis=x]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 12
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 16
},
"minecraft:oak_wood[axis=y]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 12
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 0
},
"minecraft:oak_wood[axis=z]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 12
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 32
},
"minecraft:spruce_wood[axis=x]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 13
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 17
},
"minecraft:spruce_wood[axis=y]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 13
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 1
},
"minecraft:spruce_wood[axis=z]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 13
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 33
},
"minecraft:birch_wood[axis=x]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 14
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 18
},
"minecraft:birch_wood[axis=y]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 14
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 2
},
"minecraft:birch_wood[axis=z]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 14
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 34
},
"minecraft:jungle_wood[axis=x]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 15
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 19
},
"minecraft:jungle_wood[axis=y]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 15
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 3
},
"minecraft:jungle_wood[axis=z]": {
"bedrock_identifier": "minecraft:log",
"bedrock_data": 15
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 35
},
"minecraft:acacia_wood[axis=x]": {
"bedrock_identifier": "minecraft:log2",
"bedrock_data": 12
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 20
},
"minecraft:acacia_wood[axis=y]": {
"bedrock_identifier": "minecraft:log2",
"bedrock_data": 12
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 4
},
"minecraft:acacia_wood[axis=z]": {
"bedrock_identifier": "minecraft:log2",
"bedrock_data": 12
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 36
},
"minecraft:dark_oak_wood[axis=x]": {
"bedrock_identifier": "minecraft:log2",
"bedrock_data": 13
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 21
},
"minecraft:dark_oak_wood[axis=y]": {
"bedrock_identifier": "minecraft:log2",
"bedrock_data": 13
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 5
},
"minecraft:dark_oak_wood[axis=z]": {
"bedrock_identifier": "minecraft:log2",
"bedrock_data": 13
"bedrock_identifier": "minecraft:wood",
"bedrock_data": 37
},
"minecraft:stripped_oak_wood[axis=x]": {
"bedrock_identifier": "minecraft:stripped_oak_log",
@ -577,339 +577,339 @@
},
"minecraft:oak_leaves[distance=1,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=1,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:oak_leaves[distance=2,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=2,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:oak_leaves[distance=3,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=3,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:oak_leaves[distance=4,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=4,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:oak_leaves[distance=5,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=5,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:oak_leaves[distance=6,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=6,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:oak_leaves[distance=7,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:oak_leaves[distance=7,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:spruce_leaves[distance=1,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=1,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:spruce_leaves[distance=2,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=2,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:spruce_leaves[distance=3,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=3,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:spruce_leaves[distance=4,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=4,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:spruce_leaves[distance=5,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=5,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:spruce_leaves[distance=6,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=6,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:spruce_leaves[distance=7,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:spruce_leaves[distance=7,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:birch_leaves[distance=1,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=1,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:birch_leaves[distance=2,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=2,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:birch_leaves[distance=3,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=3,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:birch_leaves[distance=4,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=4,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:birch_leaves[distance=5,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=5,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:birch_leaves[distance=6,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=6,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:birch_leaves[distance=7,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 10
"bedrock_data": 6
},
"minecraft:birch_leaves[distance=7,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 6
"bedrock_data": 2
},
"minecraft:jungle_leaves[distance=1,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=1,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:jungle_leaves[distance=2,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=2,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:jungle_leaves[distance=3,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=3,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:jungle_leaves[distance=4,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=4,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:jungle_leaves[distance=5,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=5,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:jungle_leaves[distance=6,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=6,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:jungle_leaves[distance=7,persistent=true]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 11
"bedrock_data": 7
},
"minecraft:jungle_leaves[distance=7,persistent=false]": {
"bedrock_identifier": "minecraft:leaves",
"bedrock_data": 7
"bedrock_data": 3
},
"minecraft:acacia_leaves[distance=1,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=1,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:acacia_leaves[distance=2,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=2,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:acacia_leaves[distance=3,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=3,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:acacia_leaves[distance=4,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=4,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:acacia_leaves[distance=5,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=5,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:acacia_leaves[distance=6,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=6,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:acacia_leaves[distance=7,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 8
"bedrock_data": 4
},
"minecraft:acacia_leaves[distance=7,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 4
"bedrock_data": 0
},
"minecraft:dark_oak_leaves[distance=1,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=1,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:dark_oak_leaves[distance=2,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=2,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:dark_oak_leaves[distance=3,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=3,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:dark_oak_leaves[distance=4,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=4,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:dark_oak_leaves[distance=5,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=5,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:dark_oak_leaves[distance=6,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=6,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:dark_oak_leaves[distance=7,persistent=true]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 9
"bedrock_data": 5
},
"minecraft:dark_oak_leaves[distance=7,persistent=false]": {
"bedrock_identifier": "minecraft:leaves2",
"bedrock_data": 5
"bedrock_data": 1
},
"minecraft:sponge": {
"bedrock_identifier": "minecraft:sponge",
@ -5688,8 +5688,8 @@
"bedrock_data": 9
},
"minecraft:wither_rose": {
"bedrock_identifier": "minecraft:red_flower",
"bedrock_data": 11
"bedrock_identifier": "minecraft:wither_rose",
"bedrock_data": 0
},
"minecraft:lily_of_the_valley": {
"bedrock_identifier": "minecraft:red_flower",
@ -34892,7 +34892,7 @@
"bedrock_data": 8
},
"minecraft:structure_void": {
"bedrock_identifier": "minecraft:air",
"bedrock_identifier": "minecraft:structure_void",
"bedrock_data": 0
},
"minecraft:observer[facing=north,powered=true]": {
@ -35897,23 +35897,23 @@
},
"minecraft:dead_tube_coral_block": {
"bedrock_identifier": "minecraft:coral_block",
"bedrock_data": 5
"bedrock_data": 8
},
"minecraft:dead_brain_coral_block": {
"bedrock_identifier": "minecraft:coral_block",
"bedrock_data": 6
"bedrock_data": 9
},
"minecraft:dead_bubble_coral_block": {
"bedrock_identifier": "minecraft:coral_block",
"bedrock_data": 7
"bedrock_data": 10
},
"minecraft:dead_fire_coral_block": {
"bedrock_identifier": "minecraft:coral_block",
"bedrock_data": 8
"bedrock_data": 11
},
"minecraft:dead_horn_coral_block": {
"bedrock_identifier": "minecraft:coral_block",
"bedrock_data": 9
"bedrock_data": 12
},
"minecraft:tube_coral_block": {
"bedrock_identifier": "minecraft:coral_block",
@ -35937,43 +35937,43 @@
},
"minecraft:dead_tube_coral[waterlogged=true]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 0
"bedrock_data": 8
},
"minecraft:dead_tube_coral[waterlogged=false]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 0
"bedrock_data": 8
},
"minecraft:dead_brain_coral[waterlogged=true]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 1
"bedrock_data": 9
},
"minecraft:dead_brain_coral[waterlogged=false]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 1
"bedrock_data": 9
},
"minecraft:dead_bubble_coral[waterlogged=true]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 2
"bedrock_data": 10
},
"minecraft:dead_bubble_coral[waterlogged=false]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 2
"bedrock_data": 10
},
"minecraft:dead_fire_coral[waterlogged=true]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 3
"bedrock_data": 11
},
"minecraft:dead_fire_coral[waterlogged=false]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 3
"bedrock_data": 11
},
"minecraft:dead_horn_coral[waterlogged=true]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 4
"bedrock_data": 12
},
"minecraft:dead_horn_coral[waterlogged=false]": {
"bedrock_identifier": "minecraft:coral",
"bedrock_data": 4
"bedrock_data": 12
},
"minecraft:tube_coral[waterlogged=true]": {
"bedrock_identifier": "minecraft:coral",

View file

@ -22,7 +22,7 @@ remote:
port: 25565
# Authentication type. Can be offline, online, or hybrid (see the wiki).
auth-type: offline
auth-type: online
## the Xbox/MCPE username is the key for the Java server auth-info
## this allows automatic configuration/login to the remote Java server
@ -61,4 +61,4 @@ metrics:
# If metrics should be enabled
enabled: true
# UUID of server, don't change!
uuid: generateduuid
uuid: generateduuid

View file

@ -1,6 +1,6 @@
{
"minecraft:air": {
"bedrock_id": 0,
"bedrock_id": -158,
"bedrock_data": 0
},
"minecraft:stone": {
@ -176,52 +176,52 @@
"bedrock_data": 0
},
"minecraft:stripped_oak_wood": {
"bedrock_id": -10,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 8
},
"minecraft:stripped_spruce_wood": {
"bedrock_id": -5,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 9
},
"minecraft:stripped_birch_wood": {
"bedrock_id": -6,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 10
},
"minecraft:stripped_jungle_wood": {
"bedrock_id": -7,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 11
},
"minecraft:stripped_acacia_wood": {
"bedrock_id": -8,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 12
},
"minecraft:stripped_dark_oak_wood": {
"bedrock_id": -9,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 13
},
"minecraft:oak_wood": {
"bedrock_id": 248,
"bedrock_id": -212,
"bedrock_data": 0
},
"minecraft:spruce_wood": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 1
},
"minecraft:birch_wood": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 2
},
"minecraft:jungle_wood": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 3
},
"minecraft:acacia_wood": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 4
},
"minecraft:dark_oak_wood": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -212,
"bedrock_data": 5
},
"minecraft:oak_leaves": {
"bedrock_id": 18,
@ -269,7 +269,7 @@
},
"minecraft:dispenser": {
"bedrock_id": 23,
"bedrock_data": 3
"bedrock_data": 0
},
"minecraft:sandstone": {
"bedrock_id": 24,
@ -297,7 +297,7 @@
},
"minecraft:sticky_piston": {
"bedrock_id": 29,
"bedrock_data": 1
"bedrock_data": 0
},
"minecraft:cobweb": {
"bedrock_id": 30,
@ -325,7 +325,7 @@
},
"minecraft:piston": {
"bedrock_id": 33,
"bedrock_data": 1
"bedrock_data": 0
},
"minecraft:white_wool": {
"bedrock_id": 35,
@ -432,15 +432,15 @@
"bedrock_data": 8
},
"minecraft:cornflower": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 38,
"bedrock_data": 9
},
"minecraft:lily_of_the_valley": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 38,
"bedrock_data": 10
},
"minecraft:wither_rose": {
"bedrock_id": 248,
"bedrock_id": -216,
"bedrock_data": 0
},
"minecraft:brown_mushroom": {
@ -484,11 +484,11 @@
"bedrock_data": 5
},
"minecraft:stone_slab": {
"bedrock_id": 44,
"bedrock_data": 0
"bedrock_id": -166,
"bedrock_data": 2
},
"minecraft:smooth_stone_slab": {
"bedrock_id": 248,
"bedrock_id": 44,
"bedrock_data": 0
},
"minecraft:sandstone_slab": {
@ -496,8 +496,8 @@
"bedrock_data": 1
},
"minecraft:cut_sandstone_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -166,
"bedrock_data": 3
},
"minecraft:petrified_oak_slab": {
"bedrock_id": 44,
@ -528,8 +528,8 @@
"bedrock_data": 0
},
"minecraft:cut_red_sandstone_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -166,
"bedrock_data": 4
},
"minecraft:purpur_slab": {
"bedrock_id": 182,
@ -548,19 +548,19 @@
"bedrock_data": 3
},
"minecraft:smooth_quartz": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 155,
"bedrock_data": 3
},
"minecraft:smooth_red_sandstone": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 179,
"bedrock_data": 3
},
"minecraft:smooth_sandstone": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 24,
"bedrock_data": 3
},
"minecraft:smooth_stone": {
"bedrock_id": 248,
"bedrock_id": -183,
"bedrock_data": 0
},
"minecraft:bricks": {
@ -697,7 +697,7 @@
},
"minecraft:stone_button": {
"bedrock_id": 77,
"bedrock_data": 5
"bedrock_data": 0
},
"minecraft:snow": {
"bedrock_id": 78,
@ -988,56 +988,56 @@
"bedrock_data": 1
},
"minecraft:brick_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 6
},
"minecraft:prismarine_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 11
},
"minecraft:red_sandstone_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 12
},
"minecraft:mossy_stone_brick_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 8
},
"minecraft:granite_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 2
},
"minecraft:stone_brick_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 7
},
"minecraft:nether_brick_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 9
},
"minecraft:andesite_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 4
},
"minecraft:red_nether_brick_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 13
},
"minecraft:sandstone_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 5
},
"minecraft:end_stone_brick_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 10
},
"minecraft:diorite_wall": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 139,
"bedrock_data": 3
},
"minecraft:oak_button": {
"bedrock_id": 143,
"bedrock_data": 5
"bedrock_data": 0
},
"minecraft:spruce_button": {
"bedrock_id": -144,
@ -1121,7 +1121,7 @@
},
"minecraft:dropper": {
"bedrock_id": 125,
"bedrock_data": 3
"bedrock_data": 0
},
"minecraft:white_terracotta": {
"bedrock_id": 159,
@ -1188,7 +1188,7 @@
"bedrock_data": 15
},
"minecraft:barrier": {
"bedrock_id": 95,
"bedrock_id": -161,
"bedrock_data": 0
},
"minecraft:iron_trapdoor": {
@ -1844,24 +1844,24 @@
"bedrock_data": 4
},
"minecraft:dead_brain_coral": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -131,
"bedrock_data": 9
},
"minecraft:dead_bubble_coral": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -131,
"bedrock_data": 10
},
"minecraft:dead_fire_coral": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -131,
"bedrock_data": 11
},
"minecraft:dead_horn_coral": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -131,
"bedrock_data": 12
},
"minecraft:dead_tube_coral": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -131,
"bedrock_data": 8
},
"minecraft:tube_coral_fan": {
"bedrock_id": -133,
@ -1912,51 +1912,51 @@
"bedrock_data": 0
},
"minecraft:polished_granite_stairs": {
"bedrock_id": 248,
"bedrock_id": -172,
"bedrock_data": 0
},
"minecraft:smooth_red_sandstone_stairs": {
"bedrock_id": 248,
"bedrock_id": -176,
"bedrock_data": 0
},
"minecraft:mossy_stone_brick_stairs": {
"bedrock_id": 248,
"bedrock_id": -175,
"bedrock_data": 0
},
"minecraft:polished_diorite_stairs": {
"bedrock_id": 248,
"bedrock_id": -173,
"bedrock_data": 0
},
"minecraft:mossy_cobblestone_stairs": {
"bedrock_id": 248,
"bedrock_id": -179,
"bedrock_data": 0
},
"minecraft:end_stone_brick_stairs": {
"bedrock_id": 248,
"bedrock_id": -178,
"bedrock_data": 0
},
"minecraft:stone_stairs": {
"bedrock_id": 248,
"bedrock_id": -180,
"bedrock_data": 0
},
"minecraft:smooth_sandstone_stairs": {
"bedrock_id": 248,
"bedrock_id": -177,
"bedrock_data": 0
},
"minecraft:smooth_quartz_stairs": {
"bedrock_id": 248,
"bedrock_id": -185,
"bedrock_data": 0
},
"minecraft:granite_stairs": {
"bedrock_id": 248,
"bedrock_id": -169,
"bedrock_data": 0
},
"minecraft:andesite_stairs": {
"bedrock_id": 248,
"bedrock_id": -171,
"bedrock_data": 0
},
"minecraft:red_nether_brick_stairs": {
"bedrock_id": 248,
"bedrock_id": -184,
"bedrock_data": 0
},
"minecraft:polished_andesite_stairs": {
@ -1968,59 +1968,59 @@
"bedrock_data": 0
},
"minecraft:polished_granite_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 7
},
"minecraft:smooth_red_sandstone_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 1
},
"minecraft:mossy_stone_brick_slab": {
"bedrock_id": 248,
"bedrock_id": -166,
"bedrock_data": 0
},
"minecraft:polished_diorite_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 5
},
"minecraft:mossy_cobblestone_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 182,
"bedrock_data": 5
},
"minecraft:end_stone_brick_slab": {
"bedrock_id": 248,
"bedrock_id": -162,
"bedrock_data": 0
},
"minecraft:smooth_sandstone_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 182,
"bedrock_data": 6
},
"minecraft:smooth_quartz_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -166,
"bedrock_data": 1
},
"minecraft:granite_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 6
},
"minecraft:andesite_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 3
},
"minecraft:red_nether_brick_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 182,
"bedrock_data": 7
},
"minecraft:polished_andesite_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 2
},
"minecraft:diorite_slab": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": -162,
"bedrock_data": 4
},
"minecraft:scaffolding": {
"bedrock_id": 248,
"bedrock_id": -165,
"bedrock_data": 0
},
"minecraft:iron_door": {
@ -2360,7 +2360,7 @@
"bedrock_data": 0
},
"minecraft:spruce_sign": {
"bedrock_id": 427,
"bedrock_id": 472,
"bedrock_data": 0
},
"minecraft:birch_sign": {
@ -2376,7 +2376,7 @@
"bedrock_data": 0
},
"minecraft:dark_oak_sign": {
"bedrock_id": 276,
"bedrock_id": 476,
"bedrock_data": 0
},
"minecraft:bucket": {
@ -2588,20 +2588,20 @@
"bedrock_data": 15
},
"minecraft:blue_dye": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 351,
"bedrock_data": 18
},
"minecraft:brown_dye": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 351,
"bedrock_data": 17
},
"minecraft:black_dye": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 351,
"bedrock_data": 16
},
"minecraft:white_dye": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 351,
"bedrock_data": 19
},
"minecraft:bone": {
"bedrock_id": 352,
@ -2796,8 +2796,8 @@
"bedrock_data": 43
},
"minecraft:cat_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 75
},
"minecraft:cave_spider_spawn_egg": {
"bedrock_id": 383,
@ -2848,8 +2848,8 @@
"bedrock_data": 104
},
"minecraft:fox_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 121
},
"minecraft:ghast_spawn_egg": {
"bedrock_id": 383,
@ -2888,8 +2888,8 @@
"bedrock_data": 22
},
"minecraft:panda_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 113
},
"minecraft:parrot_spawn_egg": {
"bedrock_id": 383,
@ -2904,8 +2904,8 @@
"bedrock_data": 12
},
"minecraft:pillager_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 114
},
"minecraft:polar_bear_spawn_egg": {
"bedrock_id": 383,
@ -2920,8 +2920,8 @@
"bedrock_data": 18
},
"minecraft:ravager_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 59
},
"minecraft:salmon_spawn_egg": {
"bedrock_id": 383,
@ -2964,8 +2964,8 @@
"bedrock_data": 46
},
"minecraft:trader_llama_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 29
},
"minecraft:tropical_fish_spawn_egg": {
"bedrock_id": 383,
@ -2988,8 +2988,8 @@
"bedrock_data": 57
},
"minecraft:wandering_trader_spawn_egg": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 383,
"bedrock_data": 118
},
"minecraft:witch_spawn_egg": {
"bedrock_id": 383,
@ -3301,18 +3301,18 @@
},
"minecraft:spectral_arrow": {
"bedrock_id": 262,
"bedrock_data": 2
"bedrock_data": 0
},
"minecraft:tipped_arrow": {
"bedrock_id": 440,
"bedrock_data": 1
"bedrock_id": 262,
"bedrock_data": 0
},
"minecraft:lingering_potion": {
"bedrock_id": 441,
"bedrock_data": 0
},
"minecraft:shield": {
"bedrock_id": 268,
"bedrock_id": 513,
"bedrock_data": 0
},
"minecraft:elytra": {
@ -3356,7 +3356,7 @@
"bedrock_data": 0
},
"minecraft:debug_stick": {
"bedrock_id": 248,
"bedrock_id": 280,
"bedrock_data": 0
},
"minecraft:music_disc_13": {
@ -3428,7 +3428,7 @@
"bedrock_data": 0
},
"minecraft:suspicious_stew": {
"bedrock_id": 248,
"bedrock_id": 734,
"bedrock_data": 0
},
"minecraft:loom": {
@ -3436,75 +3436,75 @@
"bedrock_data": 0
},
"minecraft:flower_banner_pattern": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 434,
"bedrock_data": 2
},
"minecraft:creeper_banner_pattern": {
"bedrock_id": 248,
"bedrock_id": 434,
"bedrock_data": 0
},
"minecraft:skull_banner_pattern": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 434,
"bedrock_data": 1
},
"minecraft:mojang_banner_pattern": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 434,
"bedrock_data": 3
},
"minecraft:globe_banner_pattern": {
"bedrock_id": 248,
"bedrock_data": 0
"bedrock_id": 434,
"bedrock_data": 4
},
"minecraft:barrel": {
"bedrock_id": 248,
"bedrock_id": -203,
"bedrock_data": 0
},
"minecraft:smoker": {
"bedrock_id": 248,
"bedrock_id": -198,
"bedrock_data": 0
},
"minecraft:blast_furnace": {
"bedrock_id": 248,
"bedrock_id": -196,
"bedrock_data": 0
},
"minecraft:cartography_table": {
"bedrock_id": 248,
"bedrock_id": -200,
"bedrock_data": 0
},
"minecraft:fletching_table": {
"bedrock_id": 248,
"bedrock_id": -201,
"bedrock_data": 0
},
"minecraft:grindstone": {
"bedrock_id": 248,
"bedrock_id": -195,
"bedrock_data": 0
},
"minecraft:lectern": {
"bedrock_id": 248,
"bedrock_id": -194,
"bedrock_data": 0
},
"minecraft:smithing_table": {
"bedrock_id": 248,
"bedrock_id": -202,
"bedrock_data": 0
},
"minecraft:stonecutter": {
"bedrock_id": 248,
"bedrock_id": -197,
"bedrock_data": 0
},
"minecraft:bell": {
"bedrock_id": 248,
"bedrock_id": -206,
"bedrock_data": 0
},
"minecraft:lantern": {
"bedrock_id": 248,
"bedrock_id": -208,
"bedrock_data": 0
},
"minecraft:sweet_berries": {
"bedrock_id": 248,
"bedrock_id": 477,
"bedrock_data": 0
},
"minecraft:campfire": {
"bedrock_id": 248,
"bedrock_id": 720,
"bedrock_data": 0
}
}

View file

@ -88,7 +88,7 @@
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<filtering>false</filtering>
</resource>
</resources>
<plugins>