-
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix legacy block wrappers with new NBT API (#2361)
(cherry picked from commit 5b674745f17d8ede505857242e5240c6dbeebfd6)
- Loading branch information
1 parent
bc63779
commit 28f1a2d
Showing
4 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LegacyBaseBlockWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* WorldEdit, a Minecraft world manipulation toolkit | ||
* Copyright (C) sk89q <http://www.sk89q.com> | ||
* Copyright (C) WorldEdit team and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.sk89q.worldedit.blocks; | ||
|
||
import com.sk89q.jnbt.CompoundTag; | ||
import com.sk89q.worldedit.util.concurrency.LazyReference; | ||
import com.sk89q.worldedit.world.block.BaseBlock; | ||
import com.sk89q.worldedit.world.block.BlockState; | ||
import org.enginehub.linbus.tree.LinCompoundTag; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
@Deprecated | ||
public class LegacyBaseBlockWrapper extends BaseBlock { | ||
protected LegacyBaseBlockWrapper(BlockState blockState) { | ||
super(blockState); | ||
} | ||
|
||
// These two methods force the legacy blocks to use the old NBT methods. | ||
@Nullable | ||
@Override | ||
public LazyReference<LinCompoundTag> getNbtReference() { | ||
CompoundTag nbtData = getNbtData(); | ||
return nbtData == null ? null : LazyReference.from(nbtData::toLinTag); | ||
} | ||
|
||
@Override | ||
public void setNbtReference(@Nullable LazyReference<LinCompoundTag> nbtData) { | ||
setNbtData(nbtData == null ? null : new CompoundTag(nbtData.getValue())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters