mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-23 07:16:39 +01:00
Don't forget about Bukkit
This commit is contained in:
parent
65f61ec703
commit
5327610c35
1 changed files with 3 additions and 7 deletions
|
@ -26,16 +26,12 @@
|
|||
|
||||
package org.geysermc.platform.bukkit.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.world.WorldManager;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
|
||||
import org.geysermc.platform.bukkit.GeyserBukkitPlugin;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||
|
||||
|
@ -48,7 +44,7 @@ public class GeyserBukkitWorldManager extends WorldManager {
|
|||
private final boolean isViaVersion;
|
||||
|
||||
@Override
|
||||
public BlockState getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||
if (session.getPlayerEntity() == null) {
|
||||
return BlockTranslator.AIR;
|
||||
}
|
||||
|
@ -59,7 +55,7 @@ public class GeyserBukkitWorldManager extends WorldManager {
|
|||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static BlockState getLegacyBlock(GeyserSession session, int x, int y, int z, boolean isViaVersion) {
|
||||
public static int getLegacyBlock(GeyserSession session, int x, int y, int z, boolean isViaVersion) {
|
||||
if (isViaVersion) {
|
||||
Block block = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getBlockAt(x, y, z);
|
||||
// Black magic that gets the old block state ID
|
||||
|
@ -68,7 +64,7 @@ public class GeyserBukkitWorldManager extends WorldManager {
|
|||
int thirteenBlockId = us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.blockMappings.getNewId(oldBlockId);
|
||||
int thirteenPointOneBlockId = Protocol1_13_1To1_13.getNewBlockStateId(thirteenBlockId);
|
||||
int fourteenBlockId = us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData.blockStateMappings.getNewId(thirteenPointOneBlockId);
|
||||
return new BlockState(MappingData.blockStateMappings.getNewId(fourteenBlockId));
|
||||
return MappingData.blockStateMappings.getNewId(fourteenBlockId);
|
||||
} else {
|
||||
return BlockTranslator.AIR;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue