Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Merge branch 'mcprotocollibupdate' of https://github.com/DoctorMacc/Geyser into DoctorMacc-mcprotocollibupdate
Dieser Commit ist enthalten in:
Commit
8c5f5829e0
@ -26,16 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.platform.bukkit.world;
|
package org.geysermc.platform.bukkit.world;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.world.WorldManager;
|
import org.geysermc.connector.network.translators.world.WorldManager;
|
||||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
|
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_13_1to1_13.Protocol1_13_1To1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||||
|
|
||||||
@ -48,7 +44,7 @@ public class GeyserBukkitWorldManager extends WorldManager {
|
|||||||
private final boolean isViaVersion;
|
private final boolean isViaVersion;
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (session.getPlayerEntity() == null) {
|
||||||
return BlockTranslator.AIR;
|
return BlockTranslator.AIR;
|
||||||
}
|
}
|
||||||
@ -59,7 +55,7 @@ public class GeyserBukkitWorldManager extends WorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@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) {
|
if (isViaVersion) {
|
||||||
Block block = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getBlockAt(x, y, z);
|
Block block = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getBlockAt(x, y, z);
|
||||||
// Black magic that gets the old block state ID
|
// 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 thirteenBlockId = us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.blockMappings.getNewId(oldBlockId);
|
||||||
int thirteenPointOneBlockId = Protocol1_13_1To1_13.getNewBlockStateId(thirteenBlockId);
|
int thirteenPointOneBlockId = Protocol1_13_1To1_13.getNewBlockStateId(thirteenBlockId);
|
||||||
int fourteenBlockId = us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData.blockStateMappings.getNewId(thirteenPointOneBlockId);
|
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 {
|
} else {
|
||||||
return BlockTranslator.AIR;
|
return BlockTranslator.AIR;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren