forked from GeyserMC/Geyser
Fix fireworks (Closes #917)
This commit is contained in:
parent
485ba1b8a7
commit
5ceb4145ac
2 changed files with 7 additions and 2 deletions
|
@ -116,7 +116,9 @@ public class FireworkEntity extends Entity {
|
||||||
|
|
||||||
fireworksBuilder.putList("Explosions", NbtType.COMPOUND, explosions);
|
fireworksBuilder.putList("Explosions", NbtType.COMPOUND, explosions);
|
||||||
|
|
||||||
metadata.put(EntityData.DISPLAY_ITEM, NbtMap.builder().put("Fireworks", fireworksBuilder.build()));
|
NbtMapBuilder builder = NbtMap.builder();
|
||||||
|
builder.put("Fireworks", fireworksBuilder.build());
|
||||||
|
metadata.put(EntityData.DISPLAY_ITEM, builder.build());
|
||||||
} else if (entityMetadata.getId() == 8 && !entityMetadata.getValue().equals(OptionalInt.empty()) && ((OptionalInt) entityMetadata.getValue()).getAsInt() == session.getPlayerEntity().getEntityId()) {
|
} else if (entityMetadata.getId() == 8 && !entityMetadata.getValue().equals(OptionalInt.empty()) && ((OptionalInt) entityMetadata.getValue()).getAsInt() == session.getPlayerEntity().getEntityId()) {
|
||||||
//Checks if the firework has an entity ID (used when a player is gliding) and checks to make sure the player that is gliding is the one getting sent the packet or else every player near the gliding player will boost too.
|
//Checks if the firework has an entity ID (used when a player is gliding) and checks to make sure the player that is gliding is the one getting sent the packet or else every player near the gliding player will boost too.
|
||||||
PlayerEntity entity = session.getPlayerEntity();
|
PlayerEntity entity = session.getPlayerEntity();
|
||||||
|
|
|
@ -98,8 +98,11 @@ public class FireworkTranslator extends NbtItemStackTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translateToJava(CompoundTag itemTag, ItemEntry itemEntry) {
|
public void translateToJava(CompoundTag itemTag, ItemEntry itemEntry) {
|
||||||
|
if (!itemTag.contains("Fireworks")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
CompoundTag fireworks = itemTag.get("Fireworks");
|
CompoundTag fireworks = itemTag.get("Fireworks");
|
||||||
if (fireworks.get("Flight") != null) {
|
if (fireworks.contains("Flight")) {
|
||||||
fireworks.put(new ByteTag("Flight", MathUtils.convertByte(fireworks.get("Flight").getValue())));
|
fireworks.put(new ByteTag("Flight", MathUtils.convertByte(fireworks.get("Flight").getValue())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue