This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partially implement sand, fully implement stairs
- Loading branch information
Showing
10 changed files
with
179 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
using System; | ||
using TrueCraft.API; | ||
using TrueCraft.API.Networking; | ||
using TrueCraft.Core.Networking.Packets; | ||
using TrueCraft.API.Entities; | ||
using TrueCraft.API.Server; | ||
using TrueCraft.API.World; | ||
using TrueCraft.Core.Logic.Blocks; | ||
|
||
namespace TrueCraft.Core.Entities | ||
{ | ||
public class FallingSandEntity : ObjectEntity, IAABBEntity | ||
{ | ||
public FallingSandEntity(Vector3 position) | ||
{ | ||
_Position = position + new Vector3(0.5); | ||
} | ||
|
||
public override byte EntityType { get { return 70; } } | ||
|
||
public override Size Size | ||
{ | ||
get | ||
{ | ||
return new Size(1); | ||
} | ||
} | ||
|
||
public override IPacket SpawnPacket | ||
{ | ||
get | ||
{ | ||
return new SpawnGenericEntityPacket(EntityID, (sbyte)EntityType, | ||
MathHelper.CreateAbsoluteInt(Position.X), MathHelper.CreateAbsoluteInt(Position.Y), | ||
MathHelper.CreateAbsoluteInt(Position.Z), 0, null, null, null); | ||
} | ||
} | ||
|
||
public override int Data { get { return 1; } } | ||
|
||
public void TerrainCollision(Vector3 collisionPoint, Vector3 collisionDirection) | ||
{ | ||
if (collisionDirection == Vector3.Down) | ||
{ | ||
EntityManager.DespawnEntity(this); | ||
World.SetBlockID((Coordinates3D)_Position, SandBlock.BlockID); | ||
} | ||
} | ||
|
||
public BoundingBox BoundingBox | ||
{ | ||
get | ||
{ | ||
return new BoundingBox(Vector3.Zero, Vector3.One); | ||
} | ||
} | ||
|
||
public bool BeginUpdate() | ||
{ | ||
EnablePropertyChange = false; | ||
return true; | ||
} | ||
|
||
public void EndUpdate(Vector3 newPosition) | ||
{ | ||
EnablePropertyChange = true; | ||
Position = newPosition; | ||
} | ||
|
||
public float AccelerationDueToGravity | ||
{ | ||
get | ||
{ | ||
return 0.4f; | ||
} | ||
} | ||
|
||
public float Drag | ||
{ | ||
get | ||
{ | ||
return 0.2f; | ||
} | ||
} | ||
|
||
public float TerminalVelocity | ||
{ | ||
get | ||
{ | ||
return 1.96f; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters