It may not be as sophisticated as f's implementation but this was the easiest way for modders to copy it.
Patch:
Show
Code: Select all
Index: fCraft/Commands/BuildingCommands.cs
===================================================================
--- fCraft/Commands/BuildingCommands.cs (revision 1634)
+++ fCraft/Commands/BuildingCommands.cs (working copy)
@@ -546,6 +546,8 @@
Block block = map.GetBlock( coord );
if( block == drawBlock ) return;
+ if( block == Block.Skip ) return;
+
if( player.CanPlace( map, coord, drawBlock, context ) != CanPlaceResult.Allowed ) {
blocksDenied++;
return;
Index: fCraft/Commands/WorldCommands.cs
===================================================================
--- fCraft/Commands/WorldCommands.cs (revision 1634)
+++ fCraft/Commands/WorldCommands.cs (working copy)
@@ -666,7 +666,7 @@
case "edge":
Block block = Map.GetBlockByName( valueText );
- if( block == Block.Undefined ) {
+ if( block == Block.Undefined || block == Block.Skip ) {
CdEnv.PrintUsage( player );
return;
}
Index: fCraft/World/Block.cs
===================================================================
--- fCraft/World/Block.cs (revision 1634)
+++ fCraft/World/Block.cs (working copy)
@@ -4,6 +4,7 @@
/// <summary> Enumeration of all standard Minecraft Classic block types. </summary>
public enum Block : byte {
Undefined = 255, // for error checking
+ Skip = 50, //May safely be changed if in conflict, do update the binding array in Player.cs.
Air = 0,
Stone = 1,
Index: fCraft/Drawing/DrawOperation.cs
===================================================================
--- fCraft/Drawing/DrawOperation.cs (revision 1634)
+++ fCraft/Drawing/DrawOperation.cs (working copy)
@@ -214,7 +214,7 @@
int blockIndex = Map.Index( Coords );
Block oldBlock = (Block)Map.Blocks[blockIndex];
- if( oldBlock == newBlock ) {
+ if( oldBlock == newBlock || newBlock == Block.Skip ) {
BlocksSkipped++;
return false;
}
Index: fCraft/Player/Player.cs
===================================================================
--- fCraft/Player/Player.cs (revision 1634)
+++ fCraft/Player/Player.cs (working copy)
@@ -824,6 +824,12 @@
return false;
}
+ if( type == Block.Skip )
+ {
+ RevertBlockNow( coord );
+ return false;
+ }
+
CanPlaceResult canPlaceResult;
if( type == Block.Stair && coord.Z > 0 && map.GetBlock( coordBelow ) == Block.Stair ) {
// stair stacking
@@ -944,7 +950,7 @@
#region Binding
- readonly Block[] bindings = new Block[50];
+ readonly Block[] bindings = new Block[51];
public void Bind( Block type, Block replacement ) {
bindings[(byte)type] = replacement;
Show
fCraft/Commands/BuildingCommands.cs: line 548
add:
fCraft/Commands/WorldCommands.cs: line 669
Change:
fCraft/World/Block.cs: line 7
Add:
fCraft/Drawing/DrawOperation.cs: line 217
Change:
fCraft/Player/Player.cs: line 827
Add:
fCraft/Player/Player.cs: near line 953 or near line 947
Change:
add:
Code: Select all
if( block == Block.Skip ) return;
Change:
Code: Select all
if( block == Block.Undefined || block == Block.Skip ) {
Add:
Code: Select all
Skip = 50, //May safely be changed if in conflict, do update the binding array in Player.cs.
Change:
Code: Select all
if( oldBlock == newBlock || newBlock == Block.Skip ) {
Add:
Code: Select all
if( type == Block.Skip )
{
RevertBlockNow( coord );
return false;
}
Change:
Code: Select all
readonly Block[] bindings = new Block[51];