Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Dec 20, 2023
0 parents commit 8126d59
Show file tree
Hide file tree
Showing 17 changed files with 815 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build data pack

on: [push, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-in-project: true

- name: Setup cache
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install

- name: Build data pack
run: poetry run beet build

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: 'one-hundred-tiny-spiders'
path: ${{ github.workspace }}/out/one-hundred-tiny-spiders/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Misode

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# One Hundred Tiny Spiders

One hundred tiny spiders are spawned when you kill a normal spider. What could go wrong?
21 changes: 21 additions & 0 deletions beet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: One Hundred Tiny Spiders
author: Misode
version: 1.0.0

require:
- bolt

data_pack:
name: "one-hundred-tiny-spiders"
pack_format: 27
description: [
{ text: "{{project_name}}", color: "green" },
{ text: "\nv{{project_version}} by {{project_author}}.", color: "dark_gray" }
]
load:
data: src

pipeline:
- mecha

output: out
562 changes: 562 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[tool.poetry]
name = "one-hundred-tiny-spiders"
version = "0.1.0"
description = "One hundred tiny spiders will spawn when killing a spider."
authors = ["Misode <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/misode/one-hundred-tiny-spiders"
repository = "https://github.com/misode/one-hundred-tiny-spiders"
classifiers = [
"Private :: Do Not Publish"
]

[tool.poetry.dependencies]
python = "^3.11"

[tool.poetry.dev-dependencies]
black = { version = "^21.12b0", allow-prereleases = true }
beet = "^0.100.0"
bolt = "^0.44.0"
mecha = "^0.85.2"

[tool.beet]
output = "build"
extend = ["beet.yaml"]

[[tool.beet.pipeline]]
output = "build"
extend = ["beet.yaml"]
data_pack.zipped = true

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
84 changes: 84 additions & 0 deletions src/minecraft/loot_tables/entities/spider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"type": "minecraft:entity",
"pools": [
{
"rolls": 1,
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:string",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 0,
"max": 2
},
"add": false
},
{
"function": "minecraft:looting_enchant",
"count": {
"type": "minecraft:uniform",
"min": 0,
"max": 1
}
}
]
}
]
},
{
"rolls": 1,
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:spider_eye",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": -1,
"max": 1
},
"add": false
},
{
"function": "minecraft:looting_enchant",
"count": {
"type": "minecraft:uniform",
"min": 0,
"max": 1
}
}
]
}
],
"conditions": [
{
"condition": "minecraft:killed_by_player"
}
]
},
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:string",
"functions": [
{
"function": "minecraft:set_nbt",
"tag": "{one_hundred_tiny_spiders:1b}"
}
]
}
]
}
],
"random_sequence": "minecraft:entities/spider"
}
5 changes: 5 additions & 0 deletions src/minecraft/tags/functions/load.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"one_hundred_tiny_spiders:load"
]
}
5 changes: 5 additions & 0 deletions src/minecraft/tags/functions/tick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"one_hundred_tiny_spiders:tick"
]
}
2 changes: 2 additions & 0 deletions src/one_hundred_tiny_spiders/functions/check_item.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute if entity @s[nbt={Item:{id:"minecraft:string",tag:{one_hundred_tiny_spiders:1b}}}] at @s run function one_hundred_tiny_spiders:spawn_tiny_spiders
tag @s add one_hundred_tiny_spiders_tracked
1 change: 1 addition & 0 deletions src/one_hundred_tiny_spiders/functions/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scoreboard objectives add one_hundred_tiny_spiders dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import random

kill @e[type=item]

for i in range(100):
dx = round(random.uniform(-0.0001, 0.0001), 8)
dy = round(random.uniform(0, 0.001), 8)
dz = round(random.uniform(-0.0001, 0.0001), 8)

scale = round(random.uniform(0.0625, 0.1), 8)

summon spider ~ ~ ~ { \
Health:100f, \
Tags:[one_hundred_tiny_spiders], \
DeathLootTable:"minecraft:empty", \
Motion: [dx, dy, dz],
Attributes:[{Name:"minecraft:generic.scale",Base:scale,Modifiers:[]}] \
}
3 changes: 3 additions & 0 deletions src/one_hundred_tiny_spiders/functions/tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
execute as @e[type=item,tag=!one_hundred_tiny_spiders_tracked] run function one_hundred_tiny_spiders:check_item

execute as @e[type=spider,tag=one_hundred_tiny_spiders] at @s run function one_hundred_tiny_spiders:tick_tiny_spider
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scoreboard players add @s one_hundred_tiny_spiders 1

scoreboard players add @s[scores={one_hundred_tiny_spiders=100..140},predicate=one_hundred_tiny_spiders:stay_alive] one_hundred_tiny_spiders 1

execute if entity @s[scores={one_hundred_tiny_spiders=144},predicate=one_hundred_tiny_spiders:play_sound] run playsound minecraft:entity.chicken.egg master @a ~ ~ ~ 0.5 2
tp @s[scores={one_hundred_tiny_spiders=150..}] ~ ~-1000 ~
4 changes: 4 additions & 0 deletions src/one_hundred_tiny_spiders/predicates/play_sound.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"condition": "minecraft:random_chance",
"chance": 0.4
}
4 changes: 4 additions & 0 deletions src/one_hundred_tiny_spiders/predicates/stay_alive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"condition": "minecraft:random_chance",
"chance": 0.5
}

0 comments on commit 8126d59

Please sign in to comment.