use of com.flowpowered.network.Message in project Glowstone by GlowstoneMC.
the class GlowPlayer method openInventory.
@Override
public void openInventory(InventoryView view) {
session.send(new CloseWindowMessage(invMonitor.getId()));
super.openInventory(view);
invMonitor = new InventoryMonitor(getOpenInventory());
int viewId = invMonitor.getId();
if (viewId != 0) {
String title = view.getTitle();
boolean defaultTitle = Objects.equals(view.getType().getDefaultTitle(), title);
if (view.getTopInventory() instanceof PlayerInventory && defaultTitle) {
title = ((PlayerInventory) view.getTopInventory()).getHolder().getName();
}
Message open = new OpenWindowMessage(viewId, invMonitor.getType(), title, ((GlowInventory) view.getTopInventory()).getRawSlots());
session.send(open);
}
updateInventory();
}
use of com.flowpowered.network.Message in project Glowstone by GlowstoneMC.
the class GlowAgeable method createSpawnMessage.
@Override
public List<Message> createSpawnMessage() {
List<Message> messages = super.createSpawnMessage();
MetadataMap map = new MetadataMap(GlowAgeable.class);
map.set(MetadataIndex.AGE_ISBABY, !isAdult());
messages.add(new EntityMetadataMessage(id, map.getEntryList()));
return messages;
}
use of com.flowpowered.network.Message in project Glowstone by GlowstoneMC.
the class GlowCreature method createSpawnMessage.
@Override
public List<Message> createSpawnMessage() {
List<Message> result = new LinkedList<>();
// spawn mob
double x = location.getX();
double y = location.getY();
double z = location.getZ();
int yaw = Position.getIntYaw(location);
int pitch = Position.getIntPitch(location);
result.add(new SpawnMobMessage(id, getUniqueId(), type.getTypeId(), x, y, z, yaw, pitch, pitch, 0, 0, 0, metadata.getEntryList()));
// head facing
result.add(new EntityHeadRotationMessage(id, yaw));
//result.add(createEquipmentMessage());
return result;
}
use of com.flowpowered.network.Message in project Glowstone by GlowstoneMC.
the class GlowHumanEntity method createSpawnMessage.
////////////////////////////////////////////////////////////////////////////
// Internals
@Override
public List<Message> createSpawnMessage() {
List<Message> result = new LinkedList<>();
// spawn player
double x = location.getX();
double y = location.getY();
double z = location.getZ();
int yaw = Position.getIntYaw(location);
int pitch = Position.getIntPitch(location);
result.add(new SpawnPlayerMessage(id, profile.getUniqueId(), x, y, z, yaw, pitch, metadata.getEntryList()));
// head facing
result.add(new EntityHeadRotationMessage(id, yaw));
// equipment
EntityEquipment equipment = getEquipment();
result.add(new EntityEquipmentMessage(id, 0, equipment.getItemInHand()));
for (int i = 0; i < 4; i++) {
result.add(new EntityEquipmentMessage(id, i + 1, equipment.getArmorContents()[i]));
}
return result;
}
use of com.flowpowered.network.Message in project Glowstone by GlowstoneMC.
the class GlowTNTPrimed method createSpawnMessage.
@Override
public List<Message> createSpawnMessage() {
double x = location.getX();
double y = location.getY();
double z = location.getZ();
int pitch = Position.getIntPitch(location);
int yaw = Position.getIntYaw(location);
LinkedList<Message> result = new LinkedList<>();
result.add(new SpawnObjectMessage(id, getUniqueId(), 50, x, y, z, pitch, yaw));
return result;
}
Aggregations