forked from GeyserMC/Geyser
Cleanup some code
This commit is contained in:
parent
87e372ce21
commit
9bd1c0fc70
2 changed files with 8 additions and 14 deletions
|
@ -151,13 +151,13 @@ public class BlockTranslator {
|
||||||
|
|
||||||
|
|
||||||
JsonNode skullVariation = entry.getValue().get("variation");
|
JsonNode skullVariation = entry.getValue().get("variation");
|
||||||
if(skullVariation != null) {
|
if(skullVariation != null) {
|
||||||
SKULL_VARIANTS.put(javaBlockState, (byte) skullVariation.intValue());
|
SKULL_VARIANTS.put(javaBlockState, (byte) skullVariation.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonNode skullRotation = entry.getValue().get("skull_rotation");
|
JsonNode skullRotation = entry.getValue().get("skull_rotation");
|
||||||
if (skullRotation != null) {
|
if (skullRotation != null) {
|
||||||
SKULL_ROTATIONS.put(javaBlockState, (byte) skullRotation.intValue());
|
SKULL_ROTATIONS.put(javaBlockState, (byte) skullRotation.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the Java ID is bed, signal that it needs a tag to show color
|
// If the Java ID is bed, signal that it needs a tag to show color
|
||||||
|
|
|
@ -2,19 +2,13 @@ package org.geysermc.connector.network.translators.block.entity;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
||||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|
||||||
import com.nukkitx.math.vector.Vector3i;
|
import com.nukkitx.math.vector.Vector3i;
|
||||||
import com.nukkitx.nbt.CompoundTagBuilder;
|
import com.nukkitx.nbt.CompoundTagBuilder;
|
||||||
import com.nukkitx.nbt.tag.StringTag;
|
import com.nukkitx.nbt.tag.CompoundTag;
|
||||||
import com.nukkitx.nbt.tag.Tag;
|
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.block.BlockTranslator;
|
import org.geysermc.connector.network.translators.block.BlockTranslator;
|
||||||
import org.geysermc.connector.utils.BlockEntityUtils;
|
import org.geysermc.connector.utils.BlockEntityUtils;
|
||||||
import org.geysermc.connector.utils.MessageUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class SkullBlockEntityTranslator {
|
public class SkullBlockEntityTranslator {
|
||||||
|
@ -24,7 +18,7 @@ public class SkullBlockEntityTranslator {
|
||||||
byte rotation = BlockTranslator.getSkullRotation(blockState);
|
byte rotation = BlockTranslator.getSkullRotation(blockState);
|
||||||
if (skullVariant > -1) {
|
if (skullVariant > -1) {
|
||||||
Position pos = new Position(position.getX(), position.getY(), position.getZ());
|
Position pos = new Position(position.getX(), position.getY(), position.getZ());
|
||||||
com.nukkitx.nbt.tag.CompoundTag finalSkullTag = getSkullTag(skullVariant, pos, rotation);
|
CompoundTag finalSkullTag = getSkullTag(skullVariant, pos, rotation);
|
||||||
// Delay needed, otherwise newly placed skulls will not appear
|
// Delay needed, otherwise newly placed skulls will not appear
|
||||||
// Delay is not needed for skulls already placed on login
|
// Delay is not needed for skulls already placed on login
|
||||||
session.getConnector().getGeneralThreadPool().schedule(() ->
|
session.getConnector().getGeneralThreadPool().schedule(() ->
|
||||||
|
@ -35,7 +29,7 @@ public class SkullBlockEntityTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static com.nukkitx.nbt.tag.CompoundTag getSkullTag(byte skullvariant, Position pos, byte rotation) {
|
public static CompoundTag getSkullTag(byte skullvariant, Position pos, byte rotation) {
|
||||||
CompoundTagBuilder tagBuilder = CompoundTagBuilder.builder()
|
CompoundTagBuilder tagBuilder = CompoundTagBuilder.builder()
|
||||||
.intTag("x", pos.getX())
|
.intTag("x", pos.getX())
|
||||||
.intTag("y", pos.getY())
|
.intTag("y", pos.getY())
|
||||||
|
|
Loading…
Reference in a new issue