Empeld
Empeld plugin documentation.
pluginbase.Objects.World.Blocks.BlockBase Class Reference

A common base used to build all blocks More...

Inheritance diagram for pluginbase.Objects.World.Blocks.BlockBase:
pluginbase.Objects.World.Blocks.IBlock essentials.BlockEntities.EntityPlaceholderBlock essentials.blocks.alien.AlienBlock essentials.Blocks.EssentialsBlock essentials.blocks.structural.StructuralBase essentials.blocks.vegetation.VegetationBase pluginbase.Objects.World.Blocks.Air pluginbase.Objects.World.Blocks.MissingBlock essentials.blocks.alien.Ground.GroundBase essentials.blocks.alien.Organic.OrganicBase essentials.blocks.alien.Vegetation.VegetationBase essentials.Blocks.Earth.EarthBase essentials.Blocks.Emitters.EmitterBase essentials.Blocks.Gas.GasBase essentials.Blocks.Geological.GeologicalBase essentials.Blocks.Lights.LightBase essentials.Blocks.Liquid.LiquidBase essentials.Blocks.Structural.StructuralBase essentials.Blocks.Visualization.ZoneBase essentials.blocks.structural.Buildings.BuildingBase essentials.blocks.structural.Decals.DecalBase essentials.blocks.structural.Doors.DoorBase< TOpened, TClosed > essentials.blocks.structural.Props.PropBase essentials.blocks.vegetation.Brush.BrushBase essentials.blocks.vegetation.Brush.GrassBase essentials.blocks.vegetation.Trees.AbstractBranch essentials.blocks.vegetation.Trees.AbstractTree essentials.blocks.vegetation.Trees.PalmTreeLeaves essentials.blocks.vegetation.Underwater.UnderwaterBase

Public Member Functions

 BlockBase ()
 Initializes an instance of the block More...
 
bool Equals (IBlock block)
 Determines whether the specified pluginbase.Objects.World.Blocks.IBlock is equal to the current pluginbase.Objects.World.Blocks.BlockBase. More...
 
sealed override bool Equals (object obj)
 Determines whether the specified System.Object is equal to the current pluginbase.Objects.World.Blocks.BlockBase. More...
 
sealed override int GetHashCode ()
 The quick hash code for the block More...
 
sealed override string ToString ()
 Returns a string representing the block More...
 
virtual Matrix4 GetDynamicMeshTransform (IWorldReadonly world, Vector3i pos)
 Gets the dynamic mesh transform. More...
 
virtual void GetDynamicMeshClones (IWorldReadonly world, Vector3i pos, Action< Matrix4 > render)
 Gets the dynamic mesh clone matricies More...
 
virtual Vector3 GetVertWavePower (Vector3 vert)
 For each vertex in the mesh/block, compute how affected it is by VertWave animation Only important if AnimationMode == VertWave More...
 
virtual bool PhysicsSimulate (IWorld world, IWorldBlock block)
 Simulates the physics. More...
 
Get< T > ()
 Get this instance extension type More...
 
void Set< T > (T extension)
 Set the specified extension. More...
 

Public Attributes

virtual Vector3 MeshOverrideNormal => null
 
virtual bool MeshReverseNormals => false
 

Properties

virtual ushort Id [get]
 Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx More...
 
string InternalName [get]
 Internal name from the attribute More...
 
bool Renderable [get]
 Determines whether or not the block is visible More...
 
virtual BlockTextureMode TextureMode [get]
 
virtual BlockRenderMode RenderMode [get]
 
virtual BlockVertexMode VertexMode [get]
 
virtual BlockAnimationMode AnimationMode [get]
 
virtual float Transparency [get]
 
virtual int TextureStretch [get]
 
virtual string MeshResource [get]
 
virtual Matrix4 MeshTransform [get]
 
virtual BlockMeshTransform MeshTransformMode [get]
 
virtual BlockMeshLodMode MeshLodMode [get]
 
virtual int MeshLodDistance [get]
 
virtual int MeshLodSkipMultiplier [get]
 
virtual string IconResource [get]
 
virtual BlockIconMode IconMode [get]
 
virtual bool HasFog [get]
 
virtual Rgba FogColor [get]
 
virtual float FogDensity [get]
 
virtual bool EmitsLight [get]
 
virtual Rgba EmitColor [get]
 
virtual float EmitRadius [get]
 
virtual bool EmitIsDirectional [get]
 
virtual Vector3 EmitDirection [get]
 
virtual float EmitDirectionFocus [get]
 
virtual bool HasParticleSystem [get]
 
virtual int ParticleSystemViewDistance [get]
 
virtual string ParticleSystemScript [get]
 
virtual bool Destructable [get]
 
virtual bool Solid [get]
 
virtual double FrictionRatio [get]
 
virtual double FallDamageRatio [get]
 
virtual double SpeedLimit [get]
 
virtual double SpeedMultiplier [get]
 
virtual int DamageInfliction [get]
 
virtual double BounceRatio [get]
 
virtual bool Climbable [get]
 
virtual bool Sloped [get]
 
virtual bool IsLiquid [get]
 
virtual float FluidDensity [get]
 
virtual BlockPermeableMode FluidPermeableMode [get]
 
virtual Vector3d GravityMultiplier [get]
 
virtual Vector3d GravityConstant [get]
 
virtual bool HasPhysics [get]
 
virtual bool PhysicsAutoStart [get]
 
virtual TimeSpan PhysicsFrequency [get]
 
virtual SoundDescriptor SoundAmbient [get]
 
virtual SoundDescriptor SoundWalk [get]
 
virtual SoundDescriptor SoundFall [get]
 
virtual SoundDescriptor SoundBreak [get]
 
virtual SoundDescriptor SoundPlace [get]
 
virtual SoundDescriptor SoundInteract [get]
 
virtual float MaterialDensity [get]
 
abstract MaterialType MaterialType [get]
 
abstract string Name [get]
 
abstract string TextureResource [get]
 
- Properties inherited from pluginbase.Objects.World.Blocks.IBlock
string Name [get]
 Display name More...
 
string InternalName [get]
 Name of the block internally (Usually defined by the attribute) More...
 
ushort Id [get]
 Id that represent the block type (usually hash of InternalName) More...
 
bool Renderable [get]
 Renderable, aka visible More...
 
BlockTextureMode TextureMode [get]
 Render mode for the block (mostly relates to texturing) More...
 
BlockRenderMode RenderMode [get]
 Defines how the faces of the block get rendered, and by what rules More...
 
BlockVertexMode VertexMode [get]
 Vertex mode of the rendered block More...
 
BlockAnimationMode AnimationMode [get]
 Gets the animation mode. More...
 
float Transparency [get]
 Amount of transparency More...
 
string TextureResource [get]
 Texture file that represents the image starting at the "content/textures/" root More...
 
int TextureStretch [get]
 Number of blocks the texture stretches (default 1). Needs rendermode stretch More...
 
BlockMeshTransform MeshTransformMode [get]
 Gets the mesh render mode More...
 
BlockMeshLodMode MeshLodMode [get]
 Gets the LOD mode for the mesh More...
 
bool MeshReverseNormals [get]
 If true, will reverse the ordering of the mesh vertices to change how normals are computed More...
 
int MeshLodDistance [get]
 Distance, in lod-levels, until the lod mode is applied More...
 
int MeshLodSkipMultiplier [get]
 Multiplying factor for how many tris to skip per lod level More...
 
string MeshResource [get]
 Gets the mesh resource. More...
 
Matrix4 MeshTransform [get]
 Gets the mesh transform matrix More...
 
Vector3 MeshOverrideNormal [get]
 If provided, overrides the normal of the mesh geometry with this normal More...
 
string IconResource [get]
 Resolved resource path to an icon representing the block More...
 
BlockIconMode IconMode [get]
 Gets the icon mode for how the resoruce is rendered More...
 
bool Destructable [get]
 Am I destructable More...
 
bool Solid [get]
 Is the block solid, that is, does it have collision More...
 
double FrictionRatio [get]
 The friction applied to walking on/through the block when slowing/stopping Normal is 1f More...
 
double FallDamageRatio [get]
 The amount of fall damage taken by falling on (normal is 1f) More...
 
double SpeedLimit [get]
 Speed limit going through the block. Normal is no limit More...
 
double SpeedMultiplier [get]
 Gets the speed multiplier. More...
 
int DamageInfliction [get]
 Amount of damage points inflicted by touching. A person is 100 damage Default 0 More...
 
double BounceRatio [get]
 When falling on this block, bounce this much. 1f is equal height as fallen Default 0 More...
 
bool Climbable [get]
 Can the block be climbed More...
 
bool Sloped [get]
 Should the block be considered to be sloped More...
 
bool IsLiquid [get]
 Gets a value indicating whether this instance is liquid. More...
 
float FluidDensity [get]
 Affects several aspects with fluids/gasses 1) Lighter density liquids will float to the top 2) Higher densities will retrict movement (i.e. sink into, or be solid) Default 0.0; More...
 
BlockPermeableMode FluidPermeableMode [get]
 Gets how this block reacts to fluids More...
 
Vector3d GravityMultiplier [get]
 Gets the gravity multiplier to affect existing gravity More...
 
Vector3d GravityConstant [get]
 Gets the gravity constant, to supply its own gravity More...
 
bool HasPhysics [get]
 Does the block have any physics (mostly for optimization) This is weather the block will actually fall/move, not whether physics is applied to entities More...
 
bool PhysicsAutoStart [get]
 Gets a value indicating whether this pluginbase.Objects.World.Blocks.IBlock physics auto starts, triggering on world-gen rather than interaction More...
 
TimeSpan PhysicsFrequency [get]
 Gets the physics delay, which is how often physics will be applied More...
 
bool HasFog [get]
 When viewport is inside block, do we alter fog (i.e. underwater) Default false More...
 
Rgba FogColor [get]
 Return a 4-tuple of fog color (RGBA) More...
 
float FogDensity [get]
 Density of the fog More...
 
bool EmitsLight [get]
 Does the block emit light More...
 
Rgba EmitColor [get]
 Emittance color More...
 
float EmitRadius [get]
 Gets the light radius of the light More...
 
bool EmitIsDirectional [get]
 Gets a value indicating whether this pluginbase.Objects.World.Blocks.IBlock emit is directional. More...
 
Vector3 EmitDirection [get]
 Gets the emit direction. More...
 
float EmitDirectionFocus [get]
 Gets the emit direction focus. More...
 
string ParticleSystemScript [get]
 Resolved path to a particle script More...
 
bool HasParticleSystem [get]
 Gets a value indicating whether this instance has particle system. More...
 
int ParticleSystemViewDistance [get]
 Gets the max distance we can view the particle system from More...
 
SoundDescriptor SoundAmbient [get]
 Ambient sound the block makes by existing More...
 
SoundDescriptor SoundWalk [get]
 Sound of walking on the block (or moving through, in case of water) More...
 
SoundDescriptor SoundFall [get]
 Sound for falling on block More...
 
SoundDescriptor SoundPlace [get]
 Sound when placing block More...
 
SoundDescriptor SoundBreak [get]
 Sound when breaking block More...
 
SoundDescriptor SoundInteract [get]
 Sound when interacting with block More...
 
float MaterialDensity [get]
 Gets the material density; aka its weight per cubic block More...
 
MaterialType MaterialType [get]
 Gets the type of the material. More...
 

Detailed Description

A common base used to build all blocks

Constructor & Destructor Documentation

◆ BlockBase()

pluginbase.Objects.World.Blocks.BlockBase.BlockBase ( )

Initializes an instance of the block

Attribute: 0

as BlockAttribute).InternalName;

27  {
28  object[] attributes = this.GetType().GetCustomAttributes( typeof(BlockAttribute), true);
29  if (attributes.Length > 0)
30  {
31  _internalName = (attributes[0] as BlockAttribute).InternalName;
32  }
33  else
34  {
35  throw new Exception("Unable to find block's internal name");
36  }
37 
38  _hash = Hashers.HashStringUInt16(_internalName);
39  }
string InternalName
Internal name from the attribute
Definition: BlockBase.cs:65
This class describes a block type provided by the plugin
Definition: BlockAttribute.cs:8

Member Function Documentation

◆ Equals() [1/2]

bool pluginbase.Objects.World.Blocks.BlockBase.Equals ( IBlock  block)

Determines whether the specified pluginbase.Objects.World.Blocks.IBlock is equal to the current pluginbase.Objects.World.Blocks.BlockBase.

Parameters
blockThe pluginbase.Objects.World.Blocks.IBlock to compare with the current pluginbase.Objects.World.Blocks.BlockBase.
Returns
true if the specified pluginbase.Objects.World.Blocks.IBlock is equal to the current pluginbase.Objects.World.Blocks.BlockBase; otherwise, false.
80  {
81  if (block == null)
82  return false;
83  return this.Id == block.Id;
84  }
virtual ushort Id
Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_...
Definition: BlockBase.cs:54

◆ Equals() [2/2]

sealed override bool pluginbase.Objects.World.Blocks.BlockBase.Equals ( object  obj)

Determines whether the specified System.Object is equal to the current pluginbase.Objects.World.Blocks.BlockBase.

Parameters
objThe System.Object to compare with the current pluginbase.Objects.World.Blocks.BlockBase.
Returns
true if the specified System.Object is equal to the current pluginbase.Objects.World.Blocks.BlockBase; otherwise, false.
93  {
94  return this.Equals(obj as IBlock);
95  }
bool Equals(IBlock block)
Determines whether the specified pluginbase.Objects.World.Blocks.IBlock is equal to the current plugi...
Definition: BlockBase.cs:79

◆ Get< T >()

T pluginbase.Objects.World.Blocks.BlockBase.Get< T > ( )

Get this instance extension type

Template Parameters
TThe 1st type parameter.

Implements pluginbase.Objects.World.Blocks.IBlock.

Type Constraints
T :class 
558  : class
559  {
560  object obj;
561  _extensions.TryGetValue( UniqueClassIds.Get<T>(), out obj );
562  return obj as T;
563  }
Associated a unique integer ID with a class type for faster lookups The unique Id are stored in the a...
Definition: UniqueClassIds.cs:10

◆ GetDynamicMeshClones()

◆ GetDynamicMeshTransform()

virtual Matrix4 pluginbase.Objects.World.Blocks.BlockBase.GetDynamicMeshTransform ( IWorldReadonly  world,
Vector3i  pos 
)
virtual

◆ GetHashCode()

sealed override int pluginbase.Objects.World.Blocks.BlockBase.GetHashCode ( )

The quick hash code for the block

Returns
A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a hash table.
103  {
104  return this.Id; //Need to use Id cause it's virtual
105  }
virtual ushort Id
Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_...
Definition: BlockBase.cs:54

◆ GetVertWavePower()

virtual Vector3 pluginbase.Objects.World.Blocks.BlockBase.GetVertWavePower ( Vector3  pt)
virtual

For each vertex in the mesh/block, compute how affected it is by VertWave animation Only important if AnimationMode == VertWave

Returns
The vert wave power.
Parameters
ptLocal vertex in block/mesh-space

Implements pluginbase.Objects.World.Blocks.IBlock.

Reimplemented in essentials.blocks.vegetation.Trees.AbstractBranch, essentials.blocks.vegetation.Brush.GrassBase, essentials.blocks.vegetation.Trees.PalmTreeLeaves, essentials.blocks.vegetation.Underwater.UnderwaterBase, essentials.blocks.vegetation.Trees.AbstractLeaves, and essentials.blocks.vegetation.Brush.BrushAnimatedBase.

212  {
213  return Vector3.One;
214  }

◆ PhysicsSimulate()

◆ Set< T >()

void pluginbase.Objects.World.Blocks.BlockBase.Set< T > ( extension)

Set the specified extension.

Parameters
extensionExtension.
Template Parameters
TThe 1st type parameter.

Attribute: id

= extension;

Implements pluginbase.Objects.World.Blocks.IBlock.

Type Constraints
T :class 
566  : class
567  {
568  if (extension == null)
569  {
570  throw new ArgumentNullException("extension");
571  }
572 
573  uint id = UniqueClassIds.Get<T>();
574  if (_extensions.ContainsKey(id))
575  {
576  throw new Exception("Block already contains extension");
577  }
578 
579  _extensions[id] = extension;
580  }
Associated a unique integer ID with a class type for faster lookups The unique Id are stored in the a...
Definition: UniqueClassIds.cs:10

◆ ToString()

sealed override string pluginbase.Objects.World.Blocks.BlockBase.ToString ( )

Returns a string representing the block

Returns
A System.String that represents the current pluginbase.Objects.World.Blocks.BlockBase.
112  {
113  return string.Format("{0}: {1}", this.Id, this.Name);
114  }
abstract string Name
Definition: BlockBase.cs:542
virtual ushort Id
Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_...
Definition: BlockBase.cs:54

Member Data Documentation

◆ MeshOverrideNormal

virtual Vector3 pluginbase.Objects.World.Blocks.BlockBase.MeshOverrideNormal => null

◆ MeshReverseNormals

virtual bool pluginbase.Objects.World.Blocks.BlockBase.MeshReverseNormals => false

Property Documentation

◆ AnimationMode

virtual BlockAnimationMode pluginbase.Objects.World.Blocks.BlockBase.AnimationMode
get

◆ BounceRatio

virtual double pluginbase.Objects.World.Blocks.BlockBase.BounceRatio
get

◆ Climbable

virtual bool pluginbase.Objects.World.Blocks.BlockBase.Climbable
get

◆ DamageInfliction

virtual int pluginbase.Objects.World.Blocks.BlockBase.DamageInfliction
get

◆ Destructable

virtual bool pluginbase.Objects.World.Blocks.BlockBase.Destructable
get

◆ EmitColor

virtual Rgba pluginbase.Objects.World.Blocks.BlockBase.EmitColor
get

◆ EmitDirection

virtual Vector3 pluginbase.Objects.World.Blocks.BlockBase.EmitDirection
get

◆ EmitDirectionFocus

virtual float pluginbase.Objects.World.Blocks.BlockBase.EmitDirectionFocus
get

◆ EmitIsDirectional

virtual bool pluginbase.Objects.World.Blocks.BlockBase.EmitIsDirectional
get

◆ EmitRadius

virtual float pluginbase.Objects.World.Blocks.BlockBase.EmitRadius
get

◆ EmitsLight

virtual bool pluginbase.Objects.World.Blocks.BlockBase.EmitsLight
get

◆ FallDamageRatio

virtual double pluginbase.Objects.World.Blocks.BlockBase.FallDamageRatio
get

◆ FluidDensity

virtual float pluginbase.Objects.World.Blocks.BlockBase.FluidDensity
get

◆ FluidPermeableMode

virtual BlockPermeableMode pluginbase.Objects.World.Blocks.BlockBase.FluidPermeableMode
get

◆ FogColor

virtual Rgba pluginbase.Objects.World.Blocks.BlockBase.FogColor
get

◆ FogDensity

virtual float pluginbase.Objects.World.Blocks.BlockBase.FogDensity
get

◆ FrictionRatio

virtual double pluginbase.Objects.World.Blocks.BlockBase.FrictionRatio
get

◆ GravityConstant

virtual Vector3d pluginbase.Objects.World.Blocks.BlockBase.GravityConstant
get

◆ GravityMultiplier

virtual Vector3d pluginbase.Objects.World.Blocks.BlockBase.GravityMultiplier
get

◆ HasFog

virtual bool pluginbase.Objects.World.Blocks.BlockBase.HasFog
get

◆ HasParticleSystem

virtual bool pluginbase.Objects.World.Blocks.BlockBase.HasParticleSystem
get

◆ HasPhysics

virtual bool pluginbase.Objects.World.Blocks.BlockBase.HasPhysics
get

◆ IconMode

virtual BlockIconMode pluginbase.Objects.World.Blocks.BlockBase.IconMode
get

◆ IconResource

virtual string pluginbase.Objects.World.Blocks.BlockBase.IconResource
get

◆ Id

virtual ushort pluginbase.Objects.World.Blocks.BlockBase.Id
get

Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx

Returns
A System.UInt16

◆ InternalName

string pluginbase.Objects.World.Blocks.BlockBase.InternalName
get

Internal name from the attribute

◆ IsLiquid

virtual bool pluginbase.Objects.World.Blocks.BlockBase.IsLiquid
get

◆ MaterialDensity

virtual float pluginbase.Objects.World.Blocks.BlockBase.MaterialDensity
get

◆ MaterialType

abstract MaterialType pluginbase.Objects.World.Blocks.BlockBase.MaterialType
get

◆ MeshLodDistance

virtual int pluginbase.Objects.World.Blocks.BlockBase.MeshLodDistance
get

◆ MeshLodMode

virtual BlockMeshLodMode pluginbase.Objects.World.Blocks.BlockBase.MeshLodMode
get

◆ MeshLodSkipMultiplier

virtual int pluginbase.Objects.World.Blocks.BlockBase.MeshLodSkipMultiplier
get

◆ MeshResource

virtual string pluginbase.Objects.World.Blocks.BlockBase.MeshResource
get

◆ MeshTransform

virtual Matrix4 pluginbase.Objects.World.Blocks.BlockBase.MeshTransform
get

◆ MeshTransformMode

virtual BlockMeshTransform pluginbase.Objects.World.Blocks.BlockBase.MeshTransformMode
get

◆ Name

abstract string pluginbase.Objects.World.Blocks.BlockBase.Name
get

◆ ParticleSystemScript

virtual string pluginbase.Objects.World.Blocks.BlockBase.ParticleSystemScript
get

◆ ParticleSystemViewDistance

virtual int pluginbase.Objects.World.Blocks.BlockBase.ParticleSystemViewDistance
get

◆ PhysicsAutoStart

virtual bool pluginbase.Objects.World.Blocks.BlockBase.PhysicsAutoStart
get

◆ PhysicsFrequency

virtual TimeSpan pluginbase.Objects.World.Blocks.BlockBase.PhysicsFrequency
get

◆ Renderable

bool pluginbase.Objects.World.Blocks.BlockBase.Renderable
get

Determines whether or not the block is visible

true if renderable; otherwise, false.

◆ RenderMode

virtual BlockRenderMode pluginbase.Objects.World.Blocks.BlockBase.RenderMode
get

◆ Sloped

virtual bool pluginbase.Objects.World.Blocks.BlockBase.Sloped
get

◆ Solid

virtual bool pluginbase.Objects.World.Blocks.BlockBase.Solid
get

◆ SoundAmbient

virtual SoundDescriptor pluginbase.Objects.World.Blocks.BlockBase.SoundAmbient
get

◆ SoundBreak

virtual SoundDescriptor pluginbase.Objects.World.Blocks.BlockBase.SoundBreak
get

◆ SoundFall

virtual SoundDescriptor pluginbase.Objects.World.Blocks.BlockBase.SoundFall
get

◆ SoundInteract

virtual SoundDescriptor pluginbase.Objects.World.Blocks.BlockBase.SoundInteract
get

◆ SoundPlace

virtual SoundDescriptor pluginbase.Objects.World.Blocks.BlockBase.SoundPlace
get

◆ SoundWalk

virtual SoundDescriptor pluginbase.Objects.World.Blocks.BlockBase.SoundWalk
get

◆ SpeedLimit

virtual double pluginbase.Objects.World.Blocks.BlockBase.SpeedLimit
get

◆ SpeedMultiplier

virtual double pluginbase.Objects.World.Blocks.BlockBase.SpeedMultiplier
get

◆ TextureMode

virtual BlockTextureMode pluginbase.Objects.World.Blocks.BlockBase.TextureMode
get

◆ TextureResource

abstract string pluginbase.Objects.World.Blocks.BlockBase.TextureResource
get

◆ TextureStretch

virtual int pluginbase.Objects.World.Blocks.BlockBase.TextureStretch
get

◆ Transparency

virtual float pluginbase.Objects.World.Blocks.BlockBase.Transparency
get

◆ VertexMode

virtual BlockVertexMode pluginbase.Objects.World.Blocks.BlockBase.VertexMode
get

The documentation for this class was generated from the following file: