Compare commits
3 Commits
7f02401df4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f7f32a07e9 | |||
| 44ea336e61 | |||
| e48580f10a |
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Vintagestory.API.Client;
|
||||
using Vintagestory.API.Common;
|
||||
using Vintagestory.API.Datastructures;
|
||||
@@ -110,6 +111,46 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetBlockInfo(IPlayer forPlayer, StringBuilder dsc)
|
||||
{
|
||||
int highlightedSlot = -1;
|
||||
BlockSelection? selection = forPlayer?.CurrentBlockSelection;
|
||||
if (selection?.Position != null && selection.Position.Equals(Pos))
|
||||
highlightedSlot = GetSlotIndex(selection.HitPosition);
|
||||
|
||||
AppendContentsBlockInfo(dsc, highlightedSlot);
|
||||
}
|
||||
|
||||
public bool AppendContentsBlockInfo(StringBuilder builder, int highlightedSlot)
|
||||
{
|
||||
int initialLength = builder.Length;
|
||||
|
||||
for (int slotIndex = 0; slotIndex < ActiveSlotCount; slotIndex++)
|
||||
{
|
||||
ItemStack? stack = inventory[slotIndex].Itemstack;
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
if (builder.Length > initialLength)
|
||||
builder.AppendLine();
|
||||
else if (initialLength > 0)
|
||||
builder.AppendLine();
|
||||
|
||||
string itemName = stack.GetName();
|
||||
if (slotIndex == highlightedSlot)
|
||||
{
|
||||
builder.Append("<font color=\"#00ffff\">");
|
||||
builder.Append(itemName);
|
||||
builder.Append("</font>");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.Append(itemName);
|
||||
}
|
||||
|
||||
return builder.Length > initialLength;
|
||||
}
|
||||
|
||||
public int GetSlotIndex(Vec3d hitPosition)
|
||||
{
|
||||
Vec3d local = ToBaseOrientation(hitPosition);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
{ "name": "Lockable" }
|
||||
],
|
||||
"variantgroups": [
|
||||
{ "code": "wood", "loadFromProperties": "block/wood" },
|
||||
{ "code": "side", "loadFromProperties": "abstract/horizontalorientation" }
|
||||
],
|
||||
"attributes": {
|
||||
@@ -21,14 +22,17 @@
|
||||
"reinforcable": true
|
||||
},
|
||||
"creativeinventory": {
|
||||
"general": ["pinboard2x2-south"],
|
||||
"decorative": ["pinboard2x2-south"]
|
||||
"general": ["pinboard2x2-oak-north"],
|
||||
"decorative": ["pinboard2x2-oak-north"]
|
||||
},
|
||||
"textures": {
|
||||
"wood": { "base": "game:block/wood/debarked/{wood}" }
|
||||
},
|
||||
"shapebytype": {
|
||||
"*-north": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 180 },
|
||||
"*-east": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 90 },
|
||||
"*-south": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 0 },
|
||||
"*-west": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 270 }
|
||||
"*-*-north": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 180 },
|
||||
"*-*-east": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 90 },
|
||||
"*-*-south": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 0 },
|
||||
"*-*-west": { "base": "dusiulkaspinboard:block/pinboard-2x2", "rotateY": 270 }
|
||||
},
|
||||
"blockmaterial": "Wood",
|
||||
"drawtype": "json",
|
||||
@@ -47,10 +51,10 @@
|
||||
"y2": 0.9375,
|
||||
"z2": 1.0,
|
||||
"rotateYByType": {
|
||||
"*-north": 180,
|
||||
"*-east": 90,
|
||||
"*-south": 0,
|
||||
"*-west": 270
|
||||
"*-*-north": 180,
|
||||
"*-*-east": 90,
|
||||
"*-*-south": 0,
|
||||
"*-*-west": 270
|
||||
}
|
||||
},
|
||||
"selectionbox": {
|
||||
@@ -61,10 +65,10 @@
|
||||
"y2": 0.9375,
|
||||
"z2": 1.0,
|
||||
"rotateYByType": {
|
||||
"*-north": 180,
|
||||
"*-east": 90,
|
||||
"*-south": 0,
|
||||
"*-west": 270
|
||||
"*-*-north": 180,
|
||||
"*-*-east": 90,
|
||||
"*-*-south": 0,
|
||||
"*-*-west": 270
|
||||
}
|
||||
},
|
||||
"combustibleProps": {
|
||||
@@ -72,9 +76,9 @@
|
||||
"burnDuration": 20
|
||||
},
|
||||
"sounds": {
|
||||
"place": "block/planks",
|
||||
"break": "block/planks",
|
||||
"hit": "block/planks"
|
||||
"place": "game:block/planks",
|
||||
"break": "game:block/planks",
|
||||
"hit": "game:block/planks"
|
||||
},
|
||||
"materialDensity": 400,
|
||||
"guiTransform": {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
{ "name": "Lockable" }
|
||||
],
|
||||
"variantgroups": [
|
||||
{ "code": "wood", "loadFromProperties": "block/wood" },
|
||||
{ "code": "side", "loadFromProperties": "abstract/horizontalorientation" }
|
||||
],
|
||||
"attributes": {
|
||||
@@ -21,14 +22,17 @@
|
||||
"reinforcable": true
|
||||
},
|
||||
"creativeinventory": {
|
||||
"general": ["pinboard3x3-south"],
|
||||
"decorative": ["pinboard3x3-south"]
|
||||
"general": ["pinboard3x3-oak-north"],
|
||||
"decorative": ["pinboard3x3-oak-north"]
|
||||
},
|
||||
"textures": {
|
||||
"wood": { "base": "game:block/wood/debarked/{wood}" }
|
||||
},
|
||||
"shapebytype": {
|
||||
"*-north": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 180 },
|
||||
"*-east": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 90 },
|
||||
"*-south": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 0 },
|
||||
"*-west": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 270 }
|
||||
"*-*-north": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 180 },
|
||||
"*-*-east": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 90 },
|
||||
"*-*-south": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 0 },
|
||||
"*-*-west": { "base": "dusiulkaspinboard:block/pinboard-3x3", "rotateY": 270 }
|
||||
},
|
||||
"blockmaterial": "Wood",
|
||||
"drawtype": "json",
|
||||
@@ -47,10 +51,10 @@
|
||||
"y2": 0.9375,
|
||||
"z2": 1.0,
|
||||
"rotateYByType": {
|
||||
"*-north": 180,
|
||||
"*-east": 90,
|
||||
"*-south": 0,
|
||||
"*-west": 270
|
||||
"*-*-north": 180,
|
||||
"*-*-east": 90,
|
||||
"*-*-south": 0,
|
||||
"*-*-west": 270
|
||||
}
|
||||
},
|
||||
"selectionbox": {
|
||||
@@ -61,10 +65,10 @@
|
||||
"y2": 0.9375,
|
||||
"z2": 1.0,
|
||||
"rotateYByType": {
|
||||
"*-north": 180,
|
||||
"*-east": 90,
|
||||
"*-south": 0,
|
||||
"*-west": 270
|
||||
"*-*-north": 180,
|
||||
"*-*-east": 90,
|
||||
"*-*-south": 0,
|
||||
"*-*-west": 270
|
||||
}
|
||||
},
|
||||
"combustibleProps": {
|
||||
@@ -72,9 +76,9 @@
|
||||
"burnDuration": 25
|
||||
},
|
||||
"sounds": {
|
||||
"place": "block/planks",
|
||||
"break": "block/planks",
|
||||
"hit": "block/planks"
|
||||
"place": "game:block/planks",
|
||||
"break": "game:block/planks",
|
||||
"hit": "game:block/planks"
|
||||
},
|
||||
"materialDensity": 400,
|
||||
"guiTransform": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"block-pinboard2x2-*": "Butterfly Pin Board (2x2)",
|
||||
"block-pinboard3x3-*": "Butterfly Pin Board (3x3)"
|
||||
"block-pinboard2x2-*-*": "Butterfly Pin Board (2x2)",
|
||||
"block-pinboard3x3-*-*": "Butterfly Pin Board (3x3)"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"ingredientPattern": "_S_\tSBS\t_S_",
|
||||
"ingredients": {
|
||||
"S": { "type": "item", "code": "game:stick" },
|
||||
"S": { "type": "item", "code": "game:plank-*", "name": "wood" },
|
||||
"B": {
|
||||
"type": "item",
|
||||
"code": "game:*-butterflypin-*"
|
||||
@@ -9,5 +9,5 @@
|
||||
},
|
||||
"width": 3,
|
||||
"height": 3,
|
||||
"output": { "type": "block", "code": "pinboard2x2-north" }
|
||||
"output": { "type": "block", "code": "pinboard2x2-{wood}-north" }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"ingredientPattern": "S_S\t_B_\tS_S",
|
||||
"ingredients": {
|
||||
"S": { "type": "item", "code": "game:stick" },
|
||||
"S": { "type": "item", "code": "game:plank-*", "name": "wood" },
|
||||
"B": {
|
||||
"type": "item",
|
||||
"code": "game:*-butterflypin-*"
|
||||
@@ -9,5 +9,5 @@
|
||||
},
|
||||
"width": 3,
|
||||
"height": 3,
|
||||
"output": { "type": "block", "code": "pinboard3x3-north" }
|
||||
"output": { "type": "block", "code": "pinboard3x3-{wood}-north" }
|
||||
}
|
||||
Reference in New Issue
Block a user