Skip to content

Instantly share code, notes, and snippets.

@StarCheater
Created June 4, 2020 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StarCheater/7d1e568b42bb2c84d99f26fcac18e765 to your computer and use it in GitHub Desktop.
Save StarCheater/7d1e568b42bb2c84d99f26fcac18e765 to your computer and use it in GitHub Desktop.
Example with no work teleport entity.
namespace VSExampleMods
{
public class TrampolineMod : ModSystem
{
public override void Start(ICoreAPI api)
{
base.Start(api);
api.RegisterBlockClass("trampoline", typeof(TrampolineBlock));
}
}
public class TrampolineBlock : Block
{
public override void OnEntityCollide(IWorldAccessor world, Entity entity, BlockPos pos, BlockFacing facing,
Vec3d collideSpeed, bool isImpact)
{
entity.TeleportTo(entity.Pos.AsBlockPos.UpCopy().ToVec3d().Add(0.5, 0.5, 0.5));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment