save

package
v0.0.0-...-c10fe95 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 6 Imported by: 0

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]interface{}{
				"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]interface{}{
				"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]interface{}{
				"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 BlockState

type BlockState struct {
	Name       string
	Properties nbt.RawMessage
}

type Chunk

type Chunk struct {
	DataVersion   int32
	XPos          int32            `nbt:"xPos"`
	YPos          int32            `nbt:"yPos"`
	ZPos          int32            `nbt:"zPos"`
	BlockEntities []nbt.RawMessage `nbt:"block_entities"`
	Structures    nbt.RawMessage   `nbt:"structures"`
	Heightmaps    struct {
		MotionBlocking         []uint64 `nbt:"MOTION_BLOCKING"`
		MotionBlockingNoLeaves []uint64 `nbt:"MOTION_BLOCKING_NO_LEAVES"`
		OceanFloor             []uint64 `nbt:"OCEAN_FLOOR"`
		WorldSurface           []uint64 `nbt:"WORLD_SURFACE"`
	}
	Sections []Section `nbt:"sections"`

	BlockTicks     nbt.RawMessage `nbt:"block_ticks"`
	FluidTicks     nbt.RawMessage `nbt:"fluid_ticks"`
	PostProcessing nbt.RawMessage
	InhabitedTime  int64
	IsLightOn      byte `nbt:"isLightOn"`
	LastUpdate     int64
	Status         string
}

Chunk is 16* chunk

func (*Chunk) Data

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

func (*Chunk) Load

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

Load read column data from []byte

type CustomBossEvent

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

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

type DimensionType

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 Item

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

type Level

type Level struct {
	Data LevelData
}

func ReadLevel

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

type LevelData

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"`
	}
	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]interface{}
	Raining                bool  `nbt:"raining"`
	RainTime               int32 `nbt:"rainTime"`
	RandomSeed             int64
	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
	}
	WanderingTraderId          []int32
	WanderingTraderSpawnChance int32
	WanderingTraderSpawnDelay  int32
	WasModded                  bool
}

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

type Section struct {
	Y           int8
	BlockStates struct {
		Palette []BlockState `nbt:"palette"`
		Data    []uint64     `nbt:"data"`
	} `nbt:"block_states"`
	Biomes struct {
		Palette []string `nbt:"palette"`
		Data    []uint64 `nbt:"data"`
	} `nbt:"biomes"`
	SkyLight   []byte
	BlockLight []byte
}

type WorldGenSettings

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