Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Furniture Datapack (outdated) #896

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
79b92c3
add furniture datapack
TheThanathor Aug 25, 2023
a22c161
add furniture table for crafting
TheThanathor Aug 25, 2023
3d61925
fix EVERYTHING
TheThanathor Aug 30, 2023
9466202
add colourability
TheThanathor Aug 31, 2023
507a667
small fixes
TheThanathor Sep 1, 2023
f4bea4f
fix water placement
TheThanathor Sep 2, 2023
ded438e
rework python script
TheThanathor Sep 20, 2023
167bc4d
file format improvements
TheThanathor Sep 21, 2023
d8f62b1
fix player head textures
TheThanathor Sep 21, 2023
7d1ce6d
clean up some old code, add sounds
TheThanathor Sep 23, 2023
2446bb3
this wasn't pushed?
TheThanathor Sep 23, 2023
5cfc3cf
Merge branch 'master' of https://github.com/Gamemode4Dev/GM4_Datapack…
misode Oct 31, 2023
4951366
Fix formatting issue in beet.yaml
misode Oct 31, 2023
5492e86
add reworked furniture
TheThanathor Dec 19, 2023
f1b51f7
Merge remote-tracking branch 'upstream/master' into furniture
TheThanathor Dec 19, 2023
e7439b7
fix furniture placing wrong when facing north
TheThanathor Dec 19, 2023
a6bdf89
Merge remote-tracking branch 'upstream/master' into furniture
TheThanathor Jan 21, 2024
262b342
final update for PS
TheThanathor Jan 21, 2024
4e40f03
pandas have gone extinct
TheThanathor Jan 22, 2024
b32825b
add metal set
TheThanathor Jan 22, 2024
9a23e98
fix some missing headers and waterlogging
TheThanathor Jan 22, 2024
2b31c3c
Merge remote-tracking branch 'upstream/master' into furniture
TheThanathor Jan 23, 2024
c2b32b4
use new gm4.utils
TheThanathor Jan 23, 2024
65c4443
fix recipe
TheThanathor Jan 25, 2024
bd4dcbe
reapply invisibility since its lost on server restart
TheThanathor Jan 27, 2024
95bf079
improve furniture breaking logic
TheThanathor Jan 30, 2024
20e6948
replace wandering trader with villagers
TheThanathor Feb 27, 2024
7f50d3d
allow turning off furniture station
TheThanathor Feb 27, 2024
782e150
fix missing headers
TheThanathor Feb 27, 2024
e505b7d
add updated seating
TheThanathor Feb 29, 2024
8ba9f79
Merge remote-tracking branch 'upstream/master' into furniture
TheThanathor Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gm4_furniture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Furniture<!--$headerTitle--><!--$pmc:delete-->

Add Furniture TODO: improve this readme! <!--$pmc:headerSize-->

### Features
- Add Furniture
34 changes: 34 additions & 0 deletions gm4_furniture/beet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
id: gm4_furniture
name: Furniture
version: 1.0.X

data_pack:
load: .

pipeline:
- gm4_furniture.generate
- gm4.plugins.extend.module
- gm4.plugins.include.lib_custom_crafters
- gm4.plugins.include.lib_forceload

meta:
gm4:
versioning:
required:
lib_forceload: 1.1.0
lib_custom_crafters: 3.0.0
schedule_loops:
- main
- slow_clock
website:
description: Furniture!
recommended: []
notes:
- Resourcepack is required for this module to work.
video: null
wiki: https://wiki.gm4.co/wiki/Furniture
credits:
Creator:
- Thanathor
Textures by:
- Kyrius
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"gm4_furniture:check_recipes"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:villager_trade",
"conditions": {
"villager": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"nbt": "{Tags:[\"gm4_furniture.furniture_station\"]}"
}
}
]
}
}
},
"rewards": {
"function": "gm4_furniture:interact/furniture_station/craft_furniture"
}
}
42 changes: 42 additions & 0 deletions gm4_furniture/data/gm4_furniture/advancements/hit_furniture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"criteria": {
"hit_furniture": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"player": [
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "player",
"gamemode": "adventure"
}
}
}
}
],
"entity": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:interaction",
"nbt": "{Tags:[\"gm4_furniture\"]}"
}
}
]
}
}
},
"requirements": [
[
"hit_furniture"
]
],
"rewards": {
"function": "gm4_furniture:break/detect_hit"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"criteria": {
"interact_with_furniture": {
"trigger": "minecraft:player_interacted_with_entity",
"conditions": {
"player": [],
"entity": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:interaction",
"nbt": "{Tags:[\"gm4_furniture\"]}"
}
}
]
}
}
},
"requirements": [
[
"interact_with_furniture"
]
],
"rewards": {
"function": "gm4_furniture:interact/detect"
}
}
10 changes: 10 additions & 0 deletions gm4_furniture/data/gm4_furniture/advancements/lightning.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:lightning_strike"
}
},
"rewards": {
"function": "gm4_furniture:technical/furniture_station/lightning/detect"
}
}
54 changes: 54 additions & 0 deletions gm4_furniture/data/gm4_furniture/advancements/place_furniture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"criteria": {
"placed_furniture": {
"trigger": "minecraft:placed_block",
"conditions": {
"player": [
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": {
"type": "minecraft:fixed",
"name": "gm4_furniture"
},
"score": "load.status"
},
"range": 1
},
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": {
"type": "minecraft:fixed",
"name": "gm4_furniture_minor"
},
"score": "load.status"
},
"range": 0
}
],
"location": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": [
"minecraft:player_head"
],
"nbt": "{SkullOwner:{Properties:{textures:[{Signature:\"gm4_furniture\"}]}}}"
}
}
]
}
}
},
"requirements": [
[
"placed_furniture"
]
],
"rewards": {
"function": "gm4_furniture:place/place_furniture"
}
}
25 changes: 25 additions & 0 deletions gm4_furniture/data/gm4_furniture/advancements/relog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:location",
"conditions": {
"player": [
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": "this",
"score": "gm4_furniture_relog"
},
"range": {
"min": 1
}
}
]
}
}
},
"rewards": {
"function": "gm4_furniture:technical/relog"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"criteria": {
"used_paintbrush": {
"trigger": "minecraft:player_interacted_with_entity",
"conditions": {
"player": [],
"item": {
"items": [
"minecraft:leather_horse_armor"
],
"nbt": "{gm4_furniture:paintbrush}"
},
"entity": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:horse"
}
}
]
}
}
},
"requirements": [
[
"used_paintbrush"
]
],
"rewards": {
"function": "gm4_furniture:technical/paintbrush/used_on_horse"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# transform color value from decimal to hex
# @s = furniture main interaction entity
# at @s
# run from break/destroy

data modify storage gm4_furniture:temp color_hex set value {}

scoreboard players operation $red gm4_furniture_data = $furniture_color gm4_furniture_data
scoreboard players operation $red gm4_furniture_data /= #65536 gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data = $red gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data /= #16 gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 0..9 store result storage gm4_furniture:temp color_hex.red_1 int 1 run scoreboard players get $add_digit gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 10 run data modify storage gm4_furniture:temp color_hex.red_1 set value "A"
execute if score $add_digit gm4_furniture_data matches 11 run data modify storage gm4_furniture:temp color_hex.red_1 set value "B"
execute if score $add_digit gm4_furniture_data matches 12 run data modify storage gm4_furniture:temp color_hex.red_1 set value "C"
execute if score $add_digit gm4_furniture_data matches 13 run data modify storage gm4_furniture:temp color_hex.red_1 set value "D"
execute if score $add_digit gm4_furniture_data matches 14 run data modify storage gm4_furniture:temp color_hex.red_1 set value "E"
execute if score $add_digit gm4_furniture_data matches 15 run data modify storage gm4_furniture:temp color_hex.red_1 set value "F"
scoreboard players operation $add_digit gm4_furniture_data = $red gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data %= #16 gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 0..9 store result storage gm4_furniture:temp color_hex.red_2 int 1 run scoreboard players get $add_digit gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 10 run data modify storage gm4_furniture:temp color_hex.red_2 set value "A"
execute if score $add_digit gm4_furniture_data matches 11 run data modify storage gm4_furniture:temp color_hex.red_2 set value "B"
execute if score $add_digit gm4_furniture_data matches 12 run data modify storage gm4_furniture:temp color_hex.red_2 set value "C"
execute if score $add_digit gm4_furniture_data matches 13 run data modify storage gm4_furniture:temp color_hex.red_2 set value "D"
execute if score $add_digit gm4_furniture_data matches 14 run data modify storage gm4_furniture:temp color_hex.red_2 set value "E"
execute if score $add_digit gm4_furniture_data matches 15 run data modify storage gm4_furniture:temp color_hex.red_2 set value "F"

scoreboard players operation $green gm4_furniture_data = $furniture_color gm4_furniture_data
scoreboard players operation $green gm4_furniture_data /= #256 gm4_furniture_data
scoreboard players operation $green gm4_furniture_data %= #256 gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data = $green gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data /= #16 gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 0..9 store result storage gm4_furniture:temp color_hex.green_1 int 1 run scoreboard players get $add_digit gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 10 run data modify storage gm4_furniture:temp color_hex.green_1 set value "A"
execute if score $add_digit gm4_furniture_data matches 11 run data modify storage gm4_furniture:temp color_hex.green_1 set value "B"
execute if score $add_digit gm4_furniture_data matches 12 run data modify storage gm4_furniture:temp color_hex.green_1 set value "C"
execute if score $add_digit gm4_furniture_data matches 13 run data modify storage gm4_furniture:temp color_hex.green_1 set value "D"
execute if score $add_digit gm4_furniture_data matches 14 run data modify storage gm4_furniture:temp color_hex.green_1 set value "E"
execute if score $add_digit gm4_furniture_data matches 15 run data modify storage gm4_furniture:temp color_hex.green_1 set value "F"
scoreboard players operation $add_digit gm4_furniture_data = $green gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data %= #16 gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 0..9 store result storage gm4_furniture:temp color_hex.green_2 int 1 run scoreboard players get $add_digit gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 10 run data modify storage gm4_furniture:temp color_hex.green_2 set value "A"
execute if score $add_digit gm4_furniture_data matches 11 run data modify storage gm4_furniture:temp color_hex.green_2 set value "B"
execute if score $add_digit gm4_furniture_data matches 12 run data modify storage gm4_furniture:temp color_hex.green_2 set value "C"
execute if score $add_digit gm4_furniture_data matches 13 run data modify storage gm4_furniture:temp color_hex.green_2 set value "D"
execute if score $add_digit gm4_furniture_data matches 14 run data modify storage gm4_furniture:temp color_hex.green_2 set value "E"
execute if score $add_digit gm4_furniture_data matches 15 run data modify storage gm4_furniture:temp color_hex.green_2 set value "F"

scoreboard players operation $blue gm4_furniture_data = $furniture_color gm4_furniture_data
scoreboard players operation $blue gm4_furniture_data %= #256 gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data = $blue gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data /= #16 gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 0..9 store result storage gm4_furniture:temp color_hex.blue_1 int 1 run scoreboard players get $add_digit gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 10 run data modify storage gm4_furniture:temp color_hex.blue_1 set value "A"
execute if score $add_digit gm4_furniture_data matches 11 run data modify storage gm4_furniture:temp color_hex.blue_1 set value "B"
execute if score $add_digit gm4_furniture_data matches 12 run data modify storage gm4_furniture:temp color_hex.blue_1 set value "C"
execute if score $add_digit gm4_furniture_data matches 13 run data modify storage gm4_furniture:temp color_hex.blue_1 set value "D"
execute if score $add_digit gm4_furniture_data matches 14 run data modify storage gm4_furniture:temp color_hex.blue_1 set value "E"
execute if score $add_digit gm4_furniture_data matches 15 run data modify storage gm4_furniture:temp color_hex.blue_1 set value "F"
scoreboard players operation $add_digit gm4_furniture_data = $blue gm4_furniture_data
scoreboard players operation $add_digit gm4_furniture_data %= #16 gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 0..9 store result storage gm4_furniture:temp color_hex.blue_2 int 1 run scoreboard players get $add_digit gm4_furniture_data
execute if score $add_digit gm4_furniture_data matches 10 run data modify storage gm4_furniture:temp color_hex.blue_2 set value "A"
execute if score $add_digit gm4_furniture_data matches 11 run data modify storage gm4_furniture:temp color_hex.blue_2 set value "B"
execute if score $add_digit gm4_furniture_data matches 12 run data modify storage gm4_furniture:temp color_hex.blue_2 set value "C"
execute if score $add_digit gm4_furniture_data matches 13 run data modify storage gm4_furniture:temp color_hex.blue_2 set value "D"
execute if score $add_digit gm4_furniture_data matches 14 run data modify storage gm4_furniture:temp color_hex.blue_2 set value "E"
execute if score $add_digit gm4_furniture_data matches 15 run data modify storage gm4_furniture:temp color_hex.blue_2 set value "F"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# destroy this furniture
# @s = furniture main interaction entity
# at @s
# run from break/process_hit
# run from break/lost_connection

# check if furniture had color data
execute store result score $furniture_color gm4_furniture_data positioned ~-0.4999 ~0.0001 ~-0.4999 run data get entity @e[type=item_display,tag=gm4_furniture,dx=0,dy=0,dz=0,limit=1] item.tag.display.color
execute if score $furniture_color gm4_furniture_data matches 16383998 run scoreboard players reset $furniture_color gm4_furniture_data
execute if score $furniture_color gm4_furniture_data matches 1.. run function gm4_furniture:break/decimal_to_hex

# unless breaking player was in creative drop the item
execute unless score $creative gm4_furniture_data matches 1 positioned ~-0.4999 ~0.0001 ~-0.4999 as @e[type=item_display,tag=gm4_furniture.display,dx=0,dy=0,dz=0,limit=1] run function gm4_furniture:break/drop_item with entity @s item.tag.data

# remove any furniture blocks that match the id
execute as @e[type=interaction,tag=gm4_furniture,distance=..8] if score @s gm4_furniture_id = $check_id gm4_furniture_id at @s run function gm4_furniture:break/remove_block

# if the broken furniture was a furniture station run some extra code
execute if entity @s[tag=gm4_furniture.furniture_station] run function gm4_furniture:break/remove_furniture_station

# destroy sound
playsound minecraft:entity.armor_stand.break block @a[distance=..8] ~ ~ ~ 1 1

# cleanup
scoreboard players reset $furniture_color gm4_furniture_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# detect hitting a furniture
# @s = player punching furniture
# at @s
advancement revoke @s only gm4_furniture:hit_furniture

# mark if the player is in creative mode
execute store success score $creative gm4_furniture_data if entity @s[gamemode=creative]

# mark if the player is holding a paintbrush in their mainhand
execute store success score $get_color gm4_furniture_data if entity @s[predicate=gm4_furniture:holding_paintbrush]

# locate the hit furniture
tag @s add gm4_furniture_target
execute as @e[type=interaction,tag=gm4_furniture,distance=..8] if data entity @s attack at @s run function gm4_furniture:break/find_main
tag @s remove gm4_furniture_target
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# drop destroyed furniture's item
# @s = furniture item display
# at @s
# run from break/destroy with @s item.tag.data
# $(furniture_id) = furniture's id

$loot spawn ~.5 ~.25 ~.5 loot gm4_furniture:furniture/$(furniture_id)
execute if score $furniture_color gm4_furniture_data matches 1.. positioned ~.5 ~.25 ~.5 store result entity @e[type=item,limit=1,sort=nearest] Item.tag.gm4_furniture.color int 1 run scoreboard players get $furniture_color gm4_furniture_data
Loading
Loading