Skip to content

Commit

Permalink
Fix EndGateway translation issue (GeyserMC#1892)
Browse files Browse the repository at this point in the history
* Fix EndGateway translation issue.

* Change contains check to instanceof LongTag as requested.

* Add space after if as requested.

Co-authored-by: Brave_Chicken <bravechickengamer@gmail.com>
  • Loading branch information
BraveChicken1 and BraveChicken1 authored Feb 2, 2021
1 parent a0db56b commit db38b0d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.LongTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.nukkitx.nbt.NbtList;
import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.nbt.NbtType;
Expand All @@ -39,7 +41,10 @@
public class EndGatewayBlockEntityTranslator extends BlockEntityTranslator {
@Override
public void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState) {
builder.put("Age", (int) ((long) tag.get("Age").getValue()));
Tag ageTag = tag.get("Age");
if (ageTag instanceof LongTag) {
builder.put("Age", (int) ((long) ageTag.getValue()));
}
// Java sometimes does not provide this tag, but Bedrock crashes if it doesn't exist
// Linked coordinates
IntList tagsList = new IntArrayList();
Expand Down

0 comments on commit db38b0d

Please sign in to comment.