save

package
v1.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// as of 1.19.2
	DefaultDimensionsGenerators = map[string]DimensionGenerator{
		"minecraft:overworld": {
			Type: "minecraft:overworld",
			Generator: map[string]any{
				"type":     "minecraft:noise",
				"settings": "minecraft:overworld",
				"biome_source": map[string]string{
					"preset": "minecraft:overworld",
					"type":   "minecraft:multi_noise",
				},
			},
		},
		"minecraft:the_end": {
			Type: "minecraft:the_end",
			Generator: map[string]any{
				"type":     "minecraft:noise",
				"settings": "minecraft:end",
				"biome_source": map[string]string{
					"type": "minecraft:the_end",
				},
			},
		},
		"minecraft:the_nether": {
			Type: "minecraft:the_nether",
			Generator: map[string]any{
				"type":     "minecraft:noise",
				"settings": "minecraft:nether",
				"biome_source": map[string]string{
					"preset": "minecraft:nether",
					"type":   "minecraft:multi_noise",
				},
			},
		},
	}
	DefaultDimensionsTypes = map[string]DimensionType{
		"minecraft:overworld": {
			FixedTime:                   0,
			HasSkylight:                 true,
			HasCeiling:                  false,
			Ultrawarm:                   false,
			Natural:                     true,
			CoordinatesScale:            1.0,
			BedWorks:                    true,
			RespawnAnchorWorks:          false,
			MinY:                        -64,
			Height:                      384,
			LogicalHeight:               384,
			Infiniburn:                  "minecraft:infiniburn_overworld",
			Effects:                     "minecraft:overworld",
			AmbientLight:                0.0,
			PiglinSafe:                  false,
			HasRaids:                    true,
			MonsterSpawnLightLevel:      7,
			MonsterSpawnBlockLightLimit: 0,
		},
		"minecraft:the_nether": {
			FixedTime:                   18000,
			HasSkylight:                 false,
			HasCeiling:                  true,
			Ultrawarm:                   true,
			Natural:                     false,
			CoordinatesScale:            8.0,
			BedWorks:                    false,
			RespawnAnchorWorks:          true,
			MinY:                        0,
			Height:                      256,
			LogicalHeight:               128,
			Infiniburn:                  "minecraft:infiniburn_nether",
			Effects:                     "minecraft:the_nether",
			AmbientLight:                0.1,
			PiglinSafe:                  true,
			HasRaids:                    false,
			MonsterSpawnLightLevel:      11,
			MonsterSpawnBlockLightLimit: 15,
		},
		"minecraft:the_end": {
			FixedTime:                   6000,
			HasSkylight:                 false,
			HasCeiling:                  false,
			Ultrawarm:                   false,
			Natural:                     false,
			CoordinatesScale:            1.0,
			BedWorks:                    false,
			RespawnAnchorWorks:          false,
			MinY:                        0,
			Height:                      256,
			LogicalHeight:               256,
			Infiniburn:                  "minecraft:infiniburn_end",
			Effects:                     "minecraft:the_end",
			AmbientLight:                0.0,
			PiglinSafe:                  false,
			HasRaids:                    true,
			MonsterSpawnLightLevel:      7,
			MonsterSpawnBlockLightLimit: 0,
		},
		"minecraft:overworld_caves": {
			FixedTime:                   0,
			HasSkylight:                 true,
			HasCeiling:                  true,
			Ultrawarm:                   false,
			Natural:                     false,
			CoordinatesScale:            1.0,
			BedWorks:                    true,
			RespawnAnchorWorks:          false,
			MinY:                        -64,
			Height:                      384,
			LogicalHeight:               384,
			Infiniburn:                  "minecraft:infiniburn_overworld",
			Effects:                     "minecraft:overworld",
			AmbientLight:                0.0,
			PiglinSafe:                  false,
			HasRaids:                    true,
			MonsterSpawnLightLevel:      7,
			MonsterSpawnBlockLightLimit: 0,
		},
	}
)

Functions

This section is empty.

Types

type BiomeState added in v1.19.4

type BiomeState string

type BlockState added in v1.16.5

type BlockState struct {
	Name       string
	Properties nbt.RawMessage
}

type Chunk

type Chunk struct {
	BlockEntities  []nbt.RawMessage `nbt:"block_entities"`
	BlockTicks     nbt.RawMessage   `nbt:"block_ticks"`
	CarvingMasks   map[string][]uint64
	DataVersion    int32
	Entities       []nbt.RawMessage    `nbt:"entities"`
	FluidTicks     nbt.RawMessage      `nbt:"fluid_ticks"`
	Heightmaps     map[string][]uint64 // keys: "WORLD_SURFACE_WG", "WORLD_SURFACE", "WORLD_SURFACE_IGNORE_SNOW", "OCEAN_FLOOR_WG", "OCEAN_FLOOR", "MOTION_BLOCKING", "MOTION_BLOCKING_NO_LEAVES"
	InhabitedTime  int64
	IsLightOn      byte `nbt:"isLightOn"`
	LastUpdate     int64
	Lights         []nbt.RawMessage
	PostProcessing nbt.RawMessage
	Sections       []Section `nbt:"sections"`
	Status         string
	Structures     nbt.RawMessage `nbt:"structures"`
	XPos           int32          `nbt:"xPos"`
	YPos           int32          `nbt:"yPos"`
	ZPos           int32          `nbt:"zPos"`
}

Chunk is 16* chunk

func (*Chunk) Data added in v1.19.0

func (c *Chunk) Data(compressingType byte) ([]byte, error)

func (*Chunk) Load added in v1.18.1

func (c *Chunk) Load(data []byte) (err error)

Load read column data from []byte

type CustomBossEvent added in v1.19.0

type CustomBossEvent struct {
	Players        [][]int32
	Color          string
	CreateWorldFog bool
	DarkenScreen   bool
	Max            int32
	Value          int32
	Name           string
	Overlay        string
	PlayBossMusic  bool
	Visible        bool
}

type DimensionGenerator added in v1.19.0

type DimensionGenerator struct {
	Type      string         `nbt:"type"`
	Generator map[string]any `nbt:"generator"`
}

type DimensionType added in v1.19.0

type DimensionType struct {
	Ultrawarm bool `nbt:"ultrawarm"`

	// When false, compasses spin randomly, and using a bed to set the respawn point or sleep, is disabled. When true, nether portals can spawn zombified piglins.
	Natural bool `nbt:"natural"`

	// The multiplier applied to coordinates when leaving the dimension. Value between 0.00001 and 30000000.0 (both inclusive)
	CoordinatesScale float64 `nbt:"coordinate_scale"`

	HasSkylight  bool    `nbt:"has_skylight"`
	HasCeiling   bool    `nbt:"has_ceiling"`
	AmbientLight float32 `nbt:"ambient_light"`
	FixedTime    int64   `nbt:"fixed_time,omitempty"`

	// idk what this really is, looks like an integer
	MonsterSpawnLightLevel      int32 `nbt:"monster_spawn_light_level"`
	MonsterSpawnBlockLightLimit int32 `nbt:"monster_spawn_block_light_limit"`

	PiglinSafe         bool   `nbt:"piglin_safe"`
	BedWorks           bool   `nbt:"bed_works"`
	RespawnAnchorWorks bool   `nbt:"respawn_anchor_works"`
	HasRaids           bool   `nbt:"has_raids"`
	LogicalHeight      int32  `nbt:"logical_height"`
	MinY               int32  `nbt:"min_y"`
	Height             int32  `nbt:"height"`
	Infiniburn         string `nbt:"infiniburn"`
	Effects            string `nbt:"effects"`
}

https://minecraft.fandom.com/wiki/Custom_dimension

type Entities added in v1.19.4

type Entities struct {
	Pos, Motion  [3]float64
	Rotation     [3]float32
	FallDistance float32
	Fire, Air    int16

	OnGround       bool
	Invulnerable   bool
	PortalCooldown int32
	UUID           [4]int32

	CustomName        string
	CustomNameVisible bool
	Silent            bool
	NoGravity         bool
	Glowing           bool
	TicksFrozen       int32
	HasVisualFire     bool
	Tags              []string
}

type Item

type Item struct {
	Count byte
	Slot  byte
	ID    string         `nbt:"id"`
	Tag   map[string]any `nbt:"tag"`
}

type Level

type Level struct {
	Data LevelData
}

func ReadLevel

func ReadLevel(r io.Reader) (data Level, err error)

type LevelData added in v1.19.0

type LevelData struct {
	AllowCommands                byte `nbt:"allowCommands"`
	BorderCenterX, BorderCenterZ float64
	BorderDamagePerBlock         float64
	BorderSafeZone               float64
	BorderSize                   float64
	BorderSizeLerpTarget         float64
	BorderSizeLerpTime           int64
	BorderWarningBlocks          float64
	BorderWarningTime            float64
	ClearWeatherTime             int32 `nbt:"clearWeatherTime"`
	CustomBossEvents             map[string]CustomBossEvent
	DataPacks                    struct {
		Enabled, Disabled []string
	}
	DataVersion      int32
	DayTime          int64
	Difficulty       byte
	DifficultyLocked bool
	DimensionData    struct {
		TheEnd struct {
			DragonFight struct {
				Gateways         []int32
				DragonKilled     byte
				PreviouslyKilled byte
			}
		} `nbt:"1"`
	}
	DragonFight struct {
		Gateways           []int32
		DragonKilled       bool
		NeedsStateScanning bool
		PreviouslyKilled   bool
	}
	GameRules              map[string]string
	WorldGenSettings       WorldGenSettings
	GameType               int32
	HardCore               bool `nbt:"hardcore"`
	Initialized            bool `nbt:"initialized"`
	LastPlayed             int64
	LevelName              string
	MapFeatures            bool
	Player                 map[string]any
	Raining                bool  `nbt:"raining"`
	RainTime               int32 `nbt:"rainTime"`
	RandomSeed             int64
	ScheduledEvents        []nbt.RawMessage
	ServerBrands           []string
	SizeOnDisk             int64
	SpawnAngle             float32
	SpawnX, SpawnY, SpawnZ int32
	Thundering             bool  `nbt:"thundering"`
	ThunderTime            int32 `nbt:"thunderTime"`
	Time                   int64
	Version                struct {
		ID       int32 `nbt:"Id"`
		Name     string
		Series   string
		Snapshot byte
	}
	StorageVersion             int32 `nbt:"version"`
	WanderingTraderId          []int32
	WanderingTraderSpawnChance int32
	WanderingTraderSpawnDelay  int32
	WasModded                  bool
}

type PaletteContainer added in v1.19.4

type PaletteContainer[T any] struct {
	Palette []T      `nbt:"palette"`
	Data    []uint64 `nbt:"data"`
}

type PlayerData

type PlayerData struct {
	DataVersion int32

	Dimension    string
	Pos          [3]float64
	Motion       [3]float64
	Rotation     [2]float32
	FallDistance float32
	FallFlying   byte
	OnGround     byte

	UUID [4]int32

	PlayerGameType  int32 `nbt:"playerGameType"`
	Air             int16
	DeathTime       int16
	Fire            int16
	HurtTime        int16
	Health          float32
	HurtByTimestamp int32
	PortalCooldown  int32

	Invulnerable     byte
	SeenCredits      byte `nbt:"seenCredits"`
	SelectedItemSlot int32
	Score            int32
	AbsorptionAmount float32

	Inventory, EnderItems []Item

	XpLevel int32
	XpP     float32
	XpTotal int32
	XpSeed  int32

	FoodExhaustionLevel float32 `nbt:"foodExhaustionLevel"`
	FoodLevel           int32   `nbt:"foodLevel"`
	FoodSaturationLevel float32 `nbt:"foodSaturationLevel"`
	FoodTickTimer       int32   `nbt:"foodTickTimer"`

	Attributes []struct {
		Base float64
		Name string
	}

	Abilities struct {
		FlySpeed     float32 `nbt:"flySpeed"`
		WalkSpeed    float32 `nbt:"walkSpeed"`
		Flying       byte    `nbt:"flying"`
		InstantBuild byte    `nbt:"instabuild"`
		Invulnerable byte    `nbt:"invulnerable"`
		MayBuild     byte    `nbt:"mayBuild"`
		MayFly       byte    `nbt:"mayfly"`
	} `nbt:"abilities"`

	RecipeBook struct {
		IsFilteringCraftable        byte `nbt:"isFilteringCraftable"`
		IsFurnaceFilteringCraftable byte `nbt:"isFurnaceFilteringCraftable"`
		IsFurnaceGUIOpen            byte `nbt:"isFurnaceGuiOpen"`
		IsGUIOpen                   byte `nbt:"isGuiOpen"`
	} `nbt:"recipeBook"`
}

func ReadPlayerData

func ReadPlayerData(r io.Reader) (data PlayerData, err error)

type Section added in v1.18.1

type Section struct {
	Y           int8
	BlockStates PaletteContainer[BlockState] `nbt:"block_states"`
	Biomes      PaletteContainer[BiomeState] `nbt:"biomes"`
	SkyLight    []byte
	BlockLight  []byte
}

type WorldGenSettings added in v1.19.0

type WorldGenSettings struct {
	BonusChest       bool                          `nbt:"bonus_chest"`
	GenerateFeatures bool                          `nbt:"generate_features"`
	Seed             int64                         `nbt:"seed"`
	Dimensions       map[string]DimensionGenerator `nbt:"dimensions"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL