Initial commit

This commit is contained in:
bad 2021-12-10 00:25:30 +01:00
commit 311c3c82ab
15 changed files with 1625 additions and 0 deletions

15
.sandstone/cache.json Normal file
View file

@ -0,0 +1,15 @@
{
"/home/mae/minesochism/src": {
"files": {
"pack.mcmeta": "43c8d1ce034b81623e3056a33964f8f1",
"data/minesochism/functions/reward.mcfunction": "f2912915296a51e738345179acbdb1ad",
"data/minesochism/functions/reward/__sleep.mcfunction": "77f38f6f8e41d136a9c302494ed0cf80",
"data/minesochism/functions/ontick.mcfunction": "e77c370b8b9d6d915302b0c53b7c3741",
"data/minesochism/functions/__init__.mcfunction": "0434668eef7a247b921707932fa6297d",
"data/minesochism/advancements/take_dmg.json": "f3aa024d150a8bcd8c6cb3f467ad1057",
"data/minecraft/tags/functions/tick.json": "a0963f62ac8e16f98cad679d01a6c639",
"data/minecraft/tags/functions/load.json": "8d6ffcdf16e2081ad5e63ba30b0079dc"
},
"resultFolder": "build/minesochism"
}
}

20
README.md Normal file
View file

@ -0,0 +1,20 @@
# Sandstone project
To build the datapack, run:
```ts
npm run build
// or
yarn build
// or
sand build
```
To automatically rebuild the datapack on each change, run:
```ts
npm run watch
// or
yarn watch
// or
sand watch
```

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minesochism:__init__"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minesochism:ontick"
]
}

View file

@ -0,0 +1,10 @@
{
"criteria": {
"impossible": {
"trigger": "minecraft:impossible"
}
},
"rewards": {
"function": "minesochism:reward"
}
}

View file

@ -0,0 +1 @@
scoreboard objectives add dmg minecraft.custom:minecraft.damage_taken

View file

@ -0,0 +1,2 @@
advancement grant @a[scores={dmg=1..}] only minesochism:take_dmg
scoreboard players set @a[scores={dmg=1..}] dmg 0

View file

@ -0,0 +1,3 @@
particle minecraft:heart ~ ~1 ~ 0 3 0 0.8 5
playsound minecraft:entity.villager.celebrate player @a ~ ~ ~ 100 0 0
schedule function minesochism:reward/__sleep 2s append

View file

@ -0,0 +1 @@
advancement revoke @a only minesochism:take_dmg

View file

@ -0,0 +1,13 @@
{
"pack": {
"pack_format": 7,
"description": [
"A ",
{
"text": "Sandstone",
"color": "gold"
},
" data pack."
]
}
}

21
package.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "minesochism",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"sandstone": "^0.13.6"
},
"devDependencies": {
"@types/node": "^16.10.2",
"sandstone-cli": "^0.5.4",
"typescript": "^4.4.3"
},
"description": "A data pack created with Sandstone",
"engines": {
"node": ">=12.9.0"
},
"scripts": {
"watch": "sand watch",
"build": "sand build"
}
}

13
sandstone.config.ts Normal file
View file

@ -0,0 +1,13 @@
import type {SandstoneConfig} from 'sandstone'
export default {
name: 'minesochism',
description: ['A ', {text: 'Sandstone', color: 'gold'}, ' data pack.'],
formatVersion: 7,
namespace: 'minesochism',
packUid: '-RjTD73q',
saveOptions: {path: './build'},
onConflict: {
default: 'warn',
},
} as SandstoneConfig

50
src/display.ts Normal file
View file

@ -0,0 +1,50 @@
/**
* This file is just an example.
* You can delete it!
*/
import {
abs,
Advancement,
MCFunction,
Objective,
particle,
playsound,
rel,
Selector,
sleep,
_,
} from "sandstone";
const reward = MCFunction("reward", async () => {
particle("minecraft:heart", rel(0, 1, 0), abs(0, 3, 0), 0.8, 5);
playsound("minecraft:entity.villager.celebrate", "player", Selector("@a"), rel(0, 0, 0), 100, 0, 0);
await sleep("2s")
dmg.revoke(Selector("@a"))
})
const dmg = Advancement("take_dmg", {
criteria: {
impossible: {
trigger: "minecraft:impossible",
},
},
rewards: {
function: reward
}
});
const dmg_score = Objective.create("dmg", "minecraft.custom:minecraft.damage_taken");
MCFunction(
"ontick",
async () => {
const selector = Selector("@a", {
scores: {
dmg: [1, +Infinity],
},
});
dmg.grant(selector)
dmg_score(selector).set(0)
},
{runEachTick: true}
);

22
tsconfig.json Normal file
View file

@ -0,0 +1,22 @@
{
"compilerOptions": {
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
// We target a minimum Node version of 12.9.0: https://stackoverflow.com/a/59787575
"target": "es2019",
"lib": [
"es2020"
],
"strict": false,
"esModuleInterop": false,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": false,
"noEmit": true,
"skipLibCheck": true,
"outDir": "build"
},
"include": [
"src"
],
}

1442
yarn.lock Normal file

File diff suppressed because it is too large Load diff