3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-09-27 22:30:08 +02:00

Change BlockEntityHandler#handleOrNewCompoundTag to a void function (#812)

Dieser Commit ist enthalten in:
EnZaXD 2024-07-07 17:31:15 +02:00 committet von GitHub
Ursprung 33d8485852
Commit 1c8438d2a6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
3 geänderte Dateien mit 4 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -71,7 +71,7 @@ public class MappedLegacyBlockItem {
@FunctionalInterface
public interface BlockEntityHandler {
CompoundTag handleOrNewCompoundTag(int block, CompoundTag tag);
void handleCompoundTag(int block, CompoundTag tag);
}
public enum Type {

Datei anzeigen

@ -51,7 +51,6 @@ import com.viaversion.nbt.tag.Tag;
import com.viaversion.viaversion.util.ComponentUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import com.viaversion.viaversion.util.IdAndData;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -289,7 +288,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
MappedLegacyBlockItem settings = getMappedBlock(block);
if (settings != null && settings.hasBlockEntityHandler()) {
settings.getBlockEntityHandler().handleOrNewCompoundTag(block, tag);
settings.getBlockEntityHandler().handleCompoundTag(block, tag);
}
}
@ -343,7 +342,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
tag.putInt("y", y + (i << 4));
tag.putInt("z", z + (chunk.getZ() << 4));
settings.getBlockEntityHandler().handleOrNewCompoundTag(block, tag);
settings.getBlockEntityHandler().handleCompoundTag(block, tag);
chunk.getBlockEntities().add(tag);
}
}

Datei anzeigen

@ -253,10 +253,7 @@ public class BlockItemPacketRewriter1_11 extends LegacyBlockItemRewriter<Clientb
protected void registerRewrites() {
// Handle spawner block entity (map to itself with custom handler)
MappedLegacyBlockItem data = itemReplacements.computeIfAbsent(IdAndData.toRawData(52), s -> new MappedLegacyBlockItem(52));
data.setBlockEntityHandler((b, tag) -> {
EntityMappings1_11.toClientSpawner(tag, true);
return tag;
});
data.setBlockEntityHandler((b, tag) -> EntityMappings1_11.toClientSpawner(tag, true));
enchantmentRewriter = new LegacyEnchantmentRewriter(nbtTagName());
enchantmentRewriter.registerEnchantment(71, "§cCurse of Vanishing");