3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-03 14:50:19 +01:00

Fix EndGateway translation issue (#1892)

* 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>
Dieser Commit ist enthalten in:
Brave Chicken 2021-02-02 17:40:28 +01:00 committet von GitHub
Ursprung a0db56ba87
Commit db38b0d45d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -27,6 +27,8 @@ package org.geysermc.connector.network.translators.world.block.entity;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntTag; 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.NbtList;
import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.nbt.NbtType; import com.nukkitx.nbt.NbtType;
@ -39,7 +41,10 @@ import java.util.LinkedHashMap;
public class EndGatewayBlockEntityTranslator extends BlockEntityTranslator { public class EndGatewayBlockEntityTranslator extends BlockEntityTranslator {
@Override @Override
public void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState) { 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 // Java sometimes does not provide this tag, but Bedrock crashes if it doesn't exist
// Linked coordinates // Linked coordinates
IntList tagsList = new IntArrayList(); IntList tagsList = new IntArrayList();