Table of Contents

Class IntDataMap2D

Namespace
Vintagestory.API.Datastructures
Assembly
VintagestoryAPI.dll

A datastructure to hold 2 dimensional data in the form of ints. Can be used to perfrom bilinear interpolation between individual values

[ProtoContract]
public class IntDataMap2D
Inheritance
IntDataMap2D
Inherited Members

Fields

BottomRightPadding

Bottom and Right padding

[ProtoMember(4)]
public int BottomRightPadding

Field Value

int

Data

[ProtoMember(1, IsPacked = true)]
public int[] Data

Field Value

int[]

Size

Full Width and Length of the map (square)

[ProtoMember(2)]
public int Size

Field Value

int

TopLeftPadding

Top and Left padding

[ProtoMember(3)]
public int TopLeftPadding

Field Value

int

Properties

InnerSize

Width and Length of the map excluding any padding

public int InnerSize { get; }

Property Value

int

Methods

CreateEmpty()

public static IntDataMap2D CreateEmpty()

Returns

IntDataMap2D

GetColorLerpedCorrectly(float, float)

public int GetColorLerpedCorrectly(float x, float z)

Parameters

x float
z float

Returns

int

GetInt(int, int)

public int GetInt(int x, int z)

Parameters

x int
z int

Returns

int

GetIntLerpedCorrectly(float, float)

public float GetIntLerpedCorrectly(float x, float z)

Parameters

x float
z float

Returns

float

GetUnpaddedColorLerped(float, float)

public int GetUnpaddedColorLerped(float x, float z)

Parameters

x float
z float

Returns

int

GetUnpaddedColorLerpedForNormalizedPos(float, float)

The parameters should both be in the range 0..1. They represent the position within the MapRegion. Calling code may need to use the (float)((double)val % 1.0) technique to ensure enough bits of precision when taking the fractional part (% 1.0), if val is large (for example a BlockPos in a 8Mx8M world)

public int GetUnpaddedColorLerpedForNormalizedPos(float x, float z)

Parameters

x float
z float

Returns

int

GetUnpaddedInt(int, int)

public int GetUnpaddedInt(int x, int z)

Parameters

x int
z int

Returns

int

GetUnpaddedIntLerped(float, float)

public float GetUnpaddedIntLerped(float x, float z)

Parameters

x float
z float

Returns

float

GetUnpaddedIntLerpedForBlockPos(int, int, int)

public int GetUnpaddedIntLerpedForBlockPos(int x, int z, int regionSize)

Parameters

x int
z int
regionSize int

Returns

int

SetInt(int, int, int)

public void SetInt(int x, int z, int value)

Parameters

x int
z int
value int