Skip to content

Commit

Permalink
Fix fireworks (Closes #917)
Browse files Browse the repository at this point in the history
  • Loading branch information
Redned235 committed Jul 12, 2020
1 parent 485ba1b commit 5ceb414
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession s

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()) {
//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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ public void translateToBedrock(CompoundTag itemTag, ItemEntry itemEntry) {

@Override
public void translateToJava(CompoundTag itemTag, ItemEntry itemEntry) {
if (!itemTag.contains("Fireworks")) {
return;
}
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())));
}

Expand Down

0 comments on commit 5ceb414

Please sign in to comment.