mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge pull request #289 from DoctorMacc/llama-decoration
Add llama decoration support
This commit is contained in:
commit
553b72bf30
2 changed files with 24 additions and 1 deletions
|
@ -26,7 +26,6 @@
|
||||||
package org.geysermc.connector.entity.living.animal.horse;
|
package org.geysermc.connector.entity.living.animal.horse;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
|
||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
import com.nukkitx.protocol.bedrock.data.EntityData;
|
import com.nukkitx.protocol.bedrock.data.EntityData;
|
||||||
import com.nukkitx.protocol.bedrock.data.ItemData;
|
import com.nukkitx.protocol.bedrock.data.ItemData;
|
||||||
|
@ -47,6 +46,27 @@ public class LlamaEntity extends ChestedHorseEntity {
|
||||||
if (entityMetadata.getId() == 19) {
|
if (entityMetadata.getId() == 19) {
|
||||||
metadata.put(EntityData.STRENGTH, entityMetadata.getValue());
|
metadata.put(EntityData.STRENGTH, entityMetadata.getValue());
|
||||||
}
|
}
|
||||||
|
// Color equipped on the llama
|
||||||
|
if (entityMetadata.getId() == 20) {
|
||||||
|
// Bedrock treats llama decoration as armor
|
||||||
|
MobArmorEquipmentPacket equipmentPacket = new MobArmorEquipmentPacket();
|
||||||
|
equipmentPacket.setRuntimeEntityId(getGeyserId());
|
||||||
|
// -1 means no armor
|
||||||
|
if ((int) entityMetadata.getValue() != -1) {
|
||||||
|
// The damage value is the dye color that Java sends us
|
||||||
|
// Always going to be a carpet so we can hardcode 171 in BlockTranslator
|
||||||
|
// The int then short conversion is required or we get a ClassCastException
|
||||||
|
equipmentPacket.setChestplate(ItemData.of(BlockTranslator.CARPET, (short)((int) entityMetadata.getValue()), 1));
|
||||||
|
} else {
|
||||||
|
equipmentPacket.setChestplate(ItemData.AIR);
|
||||||
|
}
|
||||||
|
// Required to fill out the rest of the equipment or Bedrock ignores it, including above else statement if removing armor
|
||||||
|
equipmentPacket.setBoots(ItemData.AIR);
|
||||||
|
equipmentPacket.setHelmet(ItemData.AIR);
|
||||||
|
equipmentPacket.setLeggings(ItemData.AIR);
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(equipmentPacket);
|
||||||
|
}
|
||||||
// Color of the llama
|
// Color of the llama
|
||||||
if (entityMetadata.getId() == 21) {
|
if (entityMetadata.getId() == 21) {
|
||||||
metadata.put(EntityData.VARIANT, entityMetadata.getValue());
|
metadata.put(EntityData.VARIANT, entityMetadata.getValue());
|
||||||
|
|
|
@ -55,6 +55,9 @@ public class BlockTranslator {
|
||||||
private static final Int2ObjectMap<BlockState> BEDROCK_TO_JAVA_BLOCK_MAP = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<BlockState> BEDROCK_TO_JAVA_BLOCK_MAP = new Int2ObjectOpenHashMap<>();
|
||||||
private static final IntSet WATERLOGGED = new IntOpenHashSet();
|
private static final IntSet WATERLOGGED = new IntOpenHashSet();
|
||||||
|
|
||||||
|
// Bedrock carpet ID, used in LlamaEntity.java for decoration
|
||||||
|
public static final int CARPET = 171;
|
||||||
|
|
||||||
private static final int BLOCK_STATE_VERSION = 17760256;
|
private static final int BLOCK_STATE_VERSION = 17760256;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
Loading…
Reference in a new issue