Class MapItemSavedData
java.lang.Object
net.minecraft.world.level.saveddata.SavedData
net.minecraft.world.level.saveddata.maps.MapItemSavedData
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassprivate static final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<MapItemSavedData.HoldingPlayer> private final Map<Player, MapItemSavedData.HoldingPlayer> final intfinal intstatic final com.mojang.serialization.Codec<MapItemSavedData> byte[]private final Map<String, MapDecoration> final ResourceKey<Level> private static final Stringprivate static final intfinal booleanprivate static final intstatic final intfinal bytestatic final intprivate intprivate final booleanprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMapItemSavedData(int centerX, int centerZ, byte scale, boolean trackingPosition, boolean unlimitedTracking, boolean locked, ResourceKey<Level> dimension) privateMapItemSavedData(ResourceKey<Level> dimension, int centerX, int centerZ, byte scale, ByteBuffer colors, boolean trackingPosition, boolean unlimitedTracking, boolean locked, List<MapBanner> banners, List<MapFrame> frames) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientSideDecorations(List<MapDecoration> decorations) voidaddDecoration(Holder<MapDecorationType> type, @Nullable LevelAccessor level, String key, double xPos, double zPos, double yRot, @Nullable Component name) static voidaddTargetDecoration(ItemStack itemStack, BlockPos position, String key, Holder<MapDecorationType> decorationType) private @Nullable MapItemSavedData.MapDecorationLocationcalculateDecorationLocationAndType(Holder<MapDecorationType> type, @Nullable LevelAccessor level, double yRot, float xDeltaFromCenter, float yDeltaFromCenter) private bytecalculateRotation(@Nullable LevelAccessor level, double yRot) voidcheckBanners(BlockGetter level, int x, int z) private static byteclampMapCoordinate(float deltaFromCenter) static MapItemSavedDatacreateForClient(byte scale, boolean isLocked, ResourceKey<Level> dimension) static MapItemSavedDatacreateFresh(double originX, double originY, byte scale, boolean trackingPosition, boolean unlimitedTracking, ResourceKey<Level> dimension) private @Nullable Holder<MapDecorationType> decorationTypeForPlayerOutsideMap(float xDeltaFromCenter, float yDeltaFromCenter) private static StringgetFrameKey(int id) getHoldingPlayer(Player player) @Nullable Packet<?> getUpdatePacket(MapId id, Player player) private static booleanhasMapInvisibilityItemEquipped(Player player) booleanprivate static booleanisInsideMap(float xd, float yd) booleanisTrackedCountOverLimit(int limit) locked()mapMatcher(ItemStack mapStack) private @Nullable com.mojang.datafixers.util.Pair<Holder<MapDecorationType>, Byte> playerDecorationTypeAndRotation(Holder<MapDecorationType> type, @Nullable LevelAccessor level, double yRot, float xDeltaFromCenter, float yDeltaFromCenter) voidremoveDecoration(String string) voidremovedFromFrame(BlockPos pos, int entityID) scaled()voidsetColor(int x, int y, byte newColor) private voidsetColorsDirty(int x, int y) private voidvoidtickCarriedBy(Player tickingPlayer, ItemStack itemStack) booleantoggleBanner(LevelAccessor level, BlockPos pos) static SavedDataType<MapItemSavedData> booleanupdateColor(int x, int y, byte newColor)
-
Field Details
-
MAP_SIZE
private static final int MAP_SIZE- See Also:
-
HALF_MAP_SIZE
private static final int HALF_MAP_SIZE- See Also:
-
MAX_SCALE
public static final int MAX_SCALE- See Also:
-
TRACKED_DECORATION_LIMIT
public static final int TRACKED_DECORATION_LIMIT- See Also:
-
FRAME_PREFIX
- See Also:
-
CODEC
-
centerX
public final int centerX -
centerZ
public final int centerZ -
dimension
-
trackingPosition
private final boolean trackingPosition -
unlimitedTracking
private final boolean unlimitedTracking -
scale
public final byte scale -
colors
public byte[] colors -
locked
public final boolean locked -
carriedBy
-
carriedByPlayers
-
bannerMarkers
-
decorations
-
frameMarkers
-
trackedDecorationCount
private int trackedDecorationCount
-
-
Constructor Details
-
MapItemSavedData
private MapItemSavedData(int centerX, int centerZ, byte scale, boolean trackingPosition, boolean unlimitedTracking, boolean locked, ResourceKey<Level> dimension) -
MapItemSavedData
private MapItemSavedData(ResourceKey<Level> dimension, int centerX, int centerZ, byte scale, ByteBuffer colors, boolean trackingPosition, boolean unlimitedTracking, boolean locked, List<MapBanner> banners, List<MapFrame> frames)
-
-
Method Details
-
type
-
createFresh
public static MapItemSavedData createFresh(double originX, double originY, byte scale, boolean trackingPosition, boolean unlimitedTracking, ResourceKey<Level> dimension) -
createForClient
public static MapItemSavedData createForClient(byte scale, boolean isLocked, ResourceKey<Level> dimension) -
locked
-
scaled
-
mapMatcher
-
tickCarriedBy
-
hasMapInvisibilityItemEquipped
-
removeDecoration
-
addTargetDecoration
public static void addTargetDecoration(ItemStack itemStack, BlockPos position, String key, Holder<MapDecorationType> decorationType) -
addDecoration
public void addDecoration(Holder<MapDecorationType> type, @Nullable LevelAccessor level, String key, double xPos, double zPos, double yRot, @Nullable Component name) -
calculateDecorationLocationAndType
private @Nullable MapItemSavedData.MapDecorationLocation calculateDecorationLocationAndType(Holder<MapDecorationType> type, @Nullable LevelAccessor level, double yRot, float xDeltaFromCenter, float yDeltaFromCenter) -
playerDecorationTypeAndRotation
private @Nullable com.mojang.datafixers.util.Pair<Holder<MapDecorationType>, Byte> playerDecorationTypeAndRotation(Holder<MapDecorationType> type, @Nullable LevelAccessor level, double yRot, float xDeltaFromCenter, float yDeltaFromCenter) -
calculateRotation
-
isInsideMap
private static boolean isInsideMap(float xd, float yd) -
decorationTypeForPlayerOutsideMap
private @Nullable Holder<MapDecorationType> decorationTypeForPlayerOutsideMap(float xDeltaFromCenter, float yDeltaFromCenter) -
clampMapCoordinate
private static byte clampMapCoordinate(float deltaFromCenter) -
getUpdatePacket
-
setColorsDirty
private void setColorsDirty(int x, int y) -
setDecorationsDirty
private void setDecorationsDirty() -
getHoldingPlayer
-
toggleBanner
-
checkBanners
-
getBanners
-
removedFromFrame
-
updateColor
public boolean updateColor(int x, int y, byte newColor) -
setColor
public void setColor(int x, int y, byte newColor) -
isExplorationMap
public boolean isExplorationMap() -
addClientSideDecorations
-
getDecorations
-
isTrackedCountOverLimit
public boolean isTrackedCountOverLimit(int limit) -
getFrameKey
-