npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mcpp

v0.1.6

Published

Preprocessor for Minecraft function

Downloads

3

Readme

mcpp - Minecraft function preprocessor

Build Status

mcpp is a Minecraft function preprocessor, which makes working in Minecraft functions more easier.

mcpp is in alpha, so you may experience bugs and glitches. If you encounter them, you can create an issue to report it.

Install

npm i -g mcpp

Getting started

Usage

Once you have downloaded the package, you can compile a mcpp into mcfunction by running the command mcpp <input> [output] from the command line or from a JavaScript file.

To get started on learning how to program in mcpp, take a look at our documentation.

Examples

mcpp has two types of export settings which can compile your file into a standalone mcfunction or either compile your file and makes it a Minecraft datapack (mcpp makes the datapack for you so you do not need to worry about creating one). The following examples given below show these features of mcpp.

Example 1

@desc Adds some interesting features to the game
@type normal
@export single

# The type of the file is normal (it won't loop or fire on load)
# Here the export is single, so it will be compiled into a standalone file

# Makes the water poisonous!
if ([as @a at @s] block ~ ~ ~ water) {
    effect give @a minecraft:poison 1 1 false
}

function goldParty() {
    tellraw @a {"text":"Someone stepped on a gold block!"}
    kill @a
}

# Kills everyone if a player is on a gold block
if ([as @a at @s] block ~ ~-1 ~ gold_block) {
    tellraw @s {"text":"You should be more careful..."}
    goldParty()
} else {
    tellraw @s {"text":"You are not on a gold block!"}
}

The above example adds some features to the game by making water poisonous and by killing everyone if you step on a gold block. It produces a single mcfunction file which shares the same name as that of the mcpp file.

Example 2

@desc Prevent others from jumping
@type loop
@export pack

# Here, the type is set loop (the file will loop, that is, it will fire every tick in Minecraft)
# The export is set to pack (mcpp will create a datapack and include this file in it). 
# We'll see more about the power of mcpp's datapack creation where multiple files can be included in the same datapack mcpp makes

local MAX_HEALTH = 100

if ([as @a] score @s Health matches 0) {
    tellraw @s {"text":"You died!"}
    kill @s
    scoreboard players set @s Health $MAX_HEALTH
}

if ([as @a] score @s Magic matches 25..) {
    tellraw @s {"text":"You have plenty of magic left!"}
} elseif ([as @a] score @s Magic matches ..25) {
    tellraw @s {"text":"You are running out of magic!"}
} else {
    tellraw @s {"text":"You ran out of magic!"}
}

To learn about this, take a look at the documentation.

Contributing

I haven't added enough documentation to make it practical for others to contribute to the language itself. If you are interested in fixing a bug or adding a feature, feel free to make a pull request. If you have more question, feel free to join the mcpp Discord server.