Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ private String heightmapType(final int id) {
protected void backupInconvertibleData(final UserConnection connection, final Item item, final StructuredDataContainer dataContainer, final CompoundTag backupTag) {
super.backupInconvertibleData(connection, item, dataContainer, backupTag);
final ToolProperties toolProperties = dataContainer.get(StructuredDataKey.TOOL1_21_5);
if (toolProperties != null && toolProperties.canDestroyBlocksInCreative()) {
backupTag.putBoolean("tool", true);
if (toolProperties != null && !toolProperties.canDestroyBlocksInCreative()) {
backupTag.putBoolean("tool", false);
}

final Equippable equippable = dataContainer.get(StructuredDataKey.EQUIPPABLE1_21_5);
Expand Down Expand Up @@ -511,8 +511,9 @@ protected void restoreBackupData(final Item item, final StructuredDataContainer
data.set(StructuredDataKey.TOOLTIP_DISPLAY, new TooltipDisplay(data.has(StructuredDataKey.HIDE_TOOLTIP), new IntLinkedOpenHashSet(hiddenComponentsTag.getValue())));
}

if (backupTag.getBoolean("tool")) {
data.replace(StructuredDataKey.TOOL1_20_5, StructuredDataKey.TOOL1_21_5, t -> new ToolProperties(t.rules(), t.defaultMiningSpeed(), t.damagePerBlock(), true));
if (backupTag.contains("tool")) {
final boolean canDestroyBlocksInCreative = backupTag.getBoolean("tool");
data.replace(StructuredDataKey.TOOL1_20_5, StructuredDataKey.TOOL1_21_5, t -> new ToolProperties(t.rules(), t.defaultMiningSpeed(), t.damagePerBlock(), canDestroyBlocksInCreative));
}

if (backupTag.getBoolean("equippable")) {
Expand Down