mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-04 15:41:38 +00:00
增强extra data
This commit is contained in:
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class LoadedFurniture implements Furniture {
|
||||
private final Key id;
|
||||
private final CustomFurniture furniture;
|
||||
private final AnchorType anchorType;
|
||||
private final FurnitureExtraData extraData;
|
||||
private FurnitureExtraData extraData;
|
||||
// location
|
||||
private final Location location;
|
||||
// base entity
|
||||
@@ -315,6 +316,21 @@ public class LoadedFurniture implements Furniture {
|
||||
return this.extraData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraData(FurnitureExtraData extraData) {
|
||||
this.extraData = extraData;
|
||||
this.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
try {
|
||||
this.baseEntity().getPersistentDataContainer().set(BukkitFurnitureManager.FURNITURE_EXTRA_DATA_KEY, PersistentDataType.BYTE_ARRAY, this.extraData.toBytes());
|
||||
} catch (IOException e) {
|
||||
CraftEngine.instance().logger().warn("Failed to save furniture data.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnSeatEntityForPlayer(org.bukkit.entity.Player player, Seat seat) {
|
||||
Location location = this.calculateSeatLocation(seat);
|
||||
Entity seatEntity = seat.limitPlayerRotation() ?
|
||||
|
||||
Reference in New Issue
Block a user