Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.action.ItemFramework.BlockItem Class Reference
Inheritance diagram for essentials.action.ItemFramework.BlockItem:
essentials.action.ItemFramework.ItemBase pluginbase.Objects.Syncable.SyncableObject essentials.action.ItemFramework.IItem pluginbase.Objects.Syncable.SyncableBase< T > pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetWatcher pluginbase.Objects.Syncable.INetWatcher essentials.action.ItemFramework.BlockStackItem essentials.action.ItemFramework.Interactive.UseableBlockItem

Public Member Functions

 BlockItem ()
 BlockItem (ushort blockId)
 BlockItem (IBlock block)
- Public Member Functions inherited from essentials.action.ItemFramework.ItemBase
 ItemBase ()
override string ToString ()
- Public Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
 SyncableObject ()
 Initializes a new instance of the pluginbase.Objects.Syncable.SyncableObject class. More...

Protected Member Functions

override Bitmap LoadIcon ()
 Loads the bitmap representing the image of the item More...
- Protected Member Functions inherited from essentials.action.ItemFramework.ItemBase
virtual IReadonlyModel LoadModel ()
 Loads the mesh representing the model in-world More...
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
sealed override void ResetWatch ()
 Reset variables watched status More...
sealed override void TouchRecurse ()
 Touch self, including all children of this syncable object More...
sealed override void EncodeTo (BinaryWriter writer, EncodeContext context)
 Encode changes to binary data More...
sealed override void DecodeFrom (BinaryReader reader, DecodeContext context)
 Decode changes from binary data More...
sealed override void Persist (IPersistObject obj)
 Build up a persistant object for this syncable, including all sync children and persist objects More...
sealed override void Load (IReadPersistObject obj)
 Load a given persistent object back into this instance More...
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableBase< T >
void Touch ()
 Touch the instance, notifying something has changed More...
virtual void OnChanged ()
 Raises the changed event. More...

Protected Attributes

IBlockLookup BlockManager
IResourceResolver ResourceResolver
- Protected Attributes inherited from essentials.action.ItemFramework.ItemBase
readonly IModelFactory ModelFactory
readonly IPluginLogger Logger


ushort BlockId [get]
IBlock Block [get]
override string Name [get]
override string Icon [get]
override ItemRenderMode ItemRenderMode [get]
- Properties inherited from essentials.action.ItemFramework.ItemBase
abstract string Icon [get]
 Gets the path to the icon More...
abstract string Name [get]
 Gets the name of the item More...
virtual string IconLabel [get]
virtual string Description [get]
virtual string MeshResource [get]
virtual string ModelImage [get]
virtual int MeshalizerResolution [get]
virtual float MeshalizerDepth [get]
virtual float ModelSize [get]
virtual ItemRenderMode ItemRenderMode [get]
virtual string ModelCacheKey [get]
virtual bool ShowNameplate [get]
virtual bool Bounce [get]
virtual bool AutoDespawn [get]
virtual TimeSpan AutoDespawnDelay [get]
virtual bool HasGravity [get]
virtual double ViewDistance [get]
- Properties inherited from pluginbase.Objects.Syncable.SyncableObject
virtual ushort NetOwnerId [get]
 Gets the network owner of this object (user id) More...
- Properties inherited from pluginbase.Objects.Syncable.INetSyncable
INetWatcher Watcher [get, set]
 Who is watching (who to inform of a change) More...
bool Modified [get]
 Gets a value indicating whether this pluginbase.Objects.Syncable.INetSyncable is modified. More...
- Properties inherited from essentials.action.ItemFramework.IItem
string Name [get]
 The human-readable name of the item More...
string IconLabel [get]
 Gets the wording that can appear over a icon More...
bool ShowNameplate [get]
 Whether or not to show the nameplate above the item More...
bool Bounce [get]
 Whether or not the item should bounce in the world More...
bool AutoDespawn [get]
 Whether or not the item should be subject to auto-despawn More...
TimeSpan AutoDespawnDelay [get]
 The amount of time the auto despawn will take, if set (Overrides global default) More...
bool HasGravity [get]
 Whether or not gravity affects the item More...
double ViewDistance [get]
 The distance from which the dropped item can be viewed More...

Additional Inherited Members

- Events inherited from pluginbase.Objects.Syncable.SyncableBase< T >
Action< T > Changed
 Event triggered when any change occurs on this object, either locally or over the network More...
Action< T > NetUpdate
 Event triggered when a change occurs resulting from a change over the network More...
Action< T > Touched
 Event occurs only when an object is first touched. Usually the first instance of a local-change More...

Constructor & Destructor Documentation

essentials.action.ItemFramework.BlockItem.BlockItem ( )
25  {
26  this.InjectDependencies();
27  }
essentials.action.ItemFramework.BlockItem.BlockItem ( ushort  blockId)
30  :this()
31  {
32  this._blockIdSync.Value = blockId;
33  }
essentials.action.ItemFramework.BlockItem.BlockItem ( IBlock  block)
36  :this()
37  {
38  this._blockIdSync.Value = block.Id;
39  }
ushort Id
Id that represent the block type (usually hash of InternalName)
Definition: IBlock.cs:32

Member Function Documentation

override Bitmap essentials.action.ItemFramework.BlockItem.LoadIcon ( )

Loads the bitmap representing the image of the item

The icon.

Reimplemented from essentials.action.ItemFramework.ItemBase.

80  {
81  this.Logger.LogInfo("Generating inventory icon for '{0}'...", this.Name);
82  const int ICON_SIZE = 64;
84  switch(this.Block.IconMode)
85  {
86  case BlockIconMode.Flat:
87  using(var img = new Bitmap(this.ResourceResolver.OpenRead(this.Icon)))
88  {
89  return ResizeBitmap(img, ICON_SIZE, ICON_SIZE);
90  }
91  case BlockIconMode.Default:
92  default:
93  return GetCubeifiedTexture(this.Icon, ICON_SIZE);
94  }
95  }
An enumeration representing how a block is to be rendered
Definition: BlockIconMode.cs:8
override string Name
Definition: BlockItem.cs:55
readonly IPluginLogger Logger
Definition: ItemBase.cs:22
Stream OpenRead(string module, string resource)
Opens a file for reading
IBlock Block
Definition: BlockItem.cs:47
override string Icon
Definition: BlockItem.cs:63
IResourceResolver ResourceResolver
Definition: BlockItem.cs:19
void LogInfo(string msg, params object[] args)
BlockIconMode IconMode
Gets the icon mode for how the resoruce is rendered
Definition: IBlock.cs:174

Member Data Documentation

IBlockLookup essentials.action.ItemFramework.BlockItem.BlockManager

Attribute: Dependency

IResourceResolver essentials.action.ItemFramework.BlockItem.ResourceResolver

Attribute: Dependency

Property Documentation

IBlock essentials.action.ItemFramework.BlockItem.Block
ushort essentials.action.ItemFramework.BlockItem.BlockId
override string essentials.action.ItemFramework.BlockItem.Icon
override ItemRenderMode essentials.action.ItemFramework.BlockItem.ItemRenderMode
override string essentials.action.ItemFramework.BlockItem.Name

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