diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5fba704..66ac9dd86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Relay having no help tooltip. - Fixed bug where adding more Speed Upgrades would actually slow down the device even more. +- Fixed missing textures for scheduling mode side button. ## [2.0.0-milestone.3.13] - 2024-06-16 diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_disk_interface.json new file mode 100644 index 000000000..96ab91ebf --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/black" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_disk_interface.json new file mode 100644 index 000000000..f587c6a20 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/blue" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_disk_interface.json new file mode 100644 index 000000000..b5ac4702d --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/brown" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_disk_interface.json new file mode 100644 index 000000000..b0099c895 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/cyan" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/disk_interface.json new file mode 100644 index 000000000..2755db47a --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/light_blue" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_disk_interface.json new file mode 100644 index 000000000..7a051d882 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/gray" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_disk_interface.json new file mode 100644 index 000000000..1adce57bc --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/green" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_disk_interface.json new file mode 100644 index 000000000..8a4c6ed50 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/light_gray" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_disk_interface.json new file mode 100644 index 000000000..de167f2db --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/lime" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_disk_interface.json new file mode 100644 index 000000000..517a38631 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/magenta" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_disk_interface.json new file mode 100644 index 000000000..c1e249d23 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/orange" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_disk_interface.json new file mode 100644 index 000000000..5a4930113 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/pink" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_disk_interface.json new file mode 100644 index 000000000..5615980b9 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/purple" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_disk_interface.json new file mode 100644 index 000000000..93d056560 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/red" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_disk_interface.json new file mode 100644 index 000000000..4c4a2eaf8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/white" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_disk_interface.json new file mode 100644 index 000000000..3e12c26dc --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_disk_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "refinedstorage2:block/disk_interface/yellow" + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_black.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_black.json new file mode 100644 index 000000000..5997a55f2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_black.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/black", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_blue.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_blue.json new file mode 100644 index 000000000..492f404c9 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_blue.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/blue", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_brown.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_brown.json new file mode 100644 index 000000000..7812329fc --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_brown.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/brown", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_cyan.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_cyan.json new file mode 100644 index 000000000..a5f7b6075 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_cyan.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/cyan", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_gray.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_gray.json new file mode 100644 index 000000000..99b86705d --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_gray.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/gray", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_green.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_green.json new file mode 100644 index 000000000..8226df1fe --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_green.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/green", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_light_blue.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_light_blue.json new file mode 100644 index 000000000..dfbe37916 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_light_blue.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/light_blue", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_light_gray.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_light_gray.json new file mode 100644 index 000000000..80c05ac2b --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_light_gray.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/light_gray", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_lime.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_lime.json new file mode 100644 index 000000000..f072cb384 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_lime.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/lime", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_magenta.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_magenta.json new file mode 100644 index 000000000..d00996234 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_magenta.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/magenta", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_orange.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_orange.json new file mode 100644 index 000000000..b16aa07f1 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_orange.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/orange", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_pink.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_pink.json new file mode 100644 index 000000000..d160c7088 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_pink.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/pink", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_purple.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_purple.json new file mode 100644 index 000000000..d1dafa174 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_purple.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/purple", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_red.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_red.json new file mode 100644 index 000000000..3d7900695 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_red.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/red", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_white.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_white.json new file mode 100644 index 000000000..88bc33d05 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_white.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/white", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_yellow.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_yellow.json new file mode 100644 index 000000000..9da598c1b --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/base_yellow.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/yellow", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/black.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/black.json new file mode 100644 index 000000000..10c745d24 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/black.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:black_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/blue.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/blue.json new file mode 100644 index 000000000..f01f48431 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/blue.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:blue_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/brown.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/brown.json new file mode 100644 index 000000000..b089a425b --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/brown.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:brown_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/cyan.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/cyan.json new file mode 100644 index 000000000..bfa13bcbe --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/cyan.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:cyan_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/gray.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/gray.json new file mode 100644 index 000000000..4595afd28 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/gray.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:gray_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/green.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/green.json new file mode 100644 index 000000000..9571d8ad7 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/green.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:green_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/inactive.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/inactive.json new file mode 100644 index 000000000..39389d14b --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/inactive.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage2:block/north_cutout", + "textures": { + "cutout": "refinedstorage2:block/disk_interface/cutouts/inactive", + "down": "refinedstorage2:block/bottom", + "east": "refinedstorage2:block/disk_interface/right", + "north": "refinedstorage2:block/disk_interface/front", + "particle": "refinedstorage2:block/disk_interface/right", + "south": "refinedstorage2:block/disk_interface/back", + "up": "refinedstorage2:block/disk_interface/top", + "west": "refinedstorage2:block/disk_interface/left" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/light_blue.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/light_blue.json new file mode 100644 index 000000000..685ef04f2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/light_blue.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/light_gray.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/light_gray.json new file mode 100644 index 000000000..bb6bc83f1 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/light_gray.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:light_gray_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/lime.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/lime.json new file mode 100644 index 000000000..d2bea5f74 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/lime.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:lime_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/magenta.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/magenta.json new file mode 100644 index 000000000..c9a7acb6c --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/magenta.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:magenta_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/orange.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/orange.json new file mode 100644 index 000000000..d77cb23ee --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/orange.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:orange_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/pink.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/pink.json new file mode 100644 index 000000000..4fce17282 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/pink.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:pink_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/purple.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/purple.json new file mode 100644 index 000000000..980a06800 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/purple.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:purple_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/red.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/red.json new file mode 100644 index 000000000..636e74d81 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/red.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:red_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/white.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/white.json new file mode 100644 index 000000000..58e6fd775 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/white.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:white_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/yellow.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/yellow.json new file mode 100644 index 000000000..9f2b4eec6 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/disk_interface/yellow.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:yellow_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_disk_interface.json new file mode 100644 index 000000000..10c745d24 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:black_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_disk_interface.json new file mode 100644 index 000000000..f01f48431 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:blue_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_disk_interface.json new file mode 100644 index 000000000..b089a425b --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:brown_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_disk_interface.json new file mode 100644 index 000000000..bfa13bcbe --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:cyan_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/disk_interface.json new file mode 100644 index 000000000..685ef04f2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_disk_interface.json new file mode 100644 index 000000000..4595afd28 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:gray_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_disk_interface.json new file mode 100644 index 000000000..9571d8ad7 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:green_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_disk_interface.json new file mode 100644 index 000000000..bb6bc83f1 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:light_gray_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_disk_interface.json new file mode 100644 index 000000000..d2bea5f74 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:lime_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_disk_interface.json new file mode 100644 index 000000000..c9a7acb6c --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:magenta_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_disk_interface.json new file mode 100644 index 000000000..d77cb23ee --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:orange_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_disk_interface.json new file mode 100644 index 000000000..4fce17282 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:pink_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_disk_interface.json new file mode 100644 index 000000000..980a06800 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:purple_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_disk_interface.json new file mode 100644 index 000000000..636e74d81 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:red_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_disk_interface.json new file mode 100644 index 000000000..58e6fd775 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:white_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_disk_interface.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_disk_interface.json new file mode 100644 index 000000000..9f2b4eec6 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_disk_interface.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage2:yellow_disk_interface" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java index 4c43d0f88..8ea62326c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java @@ -71,7 +71,7 @@ import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveContainerMenu; -import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceContainerMenu; import com.refinedmods.refinedstorage2.platform.common.storage.externalstorage.ExternalStorageBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.externalstorage.ExternalStorageContainerMenu; @@ -296,7 +296,8 @@ protected final void registerBlocks( final RegistryCallback callback, final BiFunction diskDriveBlockEntityFactory, final BiFunction portableGridBlockEntityFactory, - final BiFunction creativePortableGridBlockEntityFactory + final BiFunction creativePortableGridBlockEntityFactory, + final BiFunction diskInterfaceBlockEntityFactory ) { Blocks.INSTANCE.setQuartzEnrichedIronBlock(callback.register(QUARTZ_ENRICHED_IRON_BLOCK, SimpleBlock::new)); Blocks.INSTANCE.setDiskDrive( @@ -341,7 +342,7 @@ protected final void registerBlocks( ))); Blocks.INSTANCE.getSecurityManager().registerBlocks(callback); Blocks.INSTANCE.getRelay().registerBlocks(callback); - Blocks.INSTANCE.getDiskInterface().registerBlocks(callback); + Blocks.INSTANCE.setDiskInterface(diskInterfaceBlockEntityFactory).registerBlocks(callback); } protected final void registerItems(final RegistryCallback callback) { @@ -537,7 +538,9 @@ protected final void registerBlockEntities( final BlockEntityTypeFactory.BlockEntitySupplier portableGridBlockEntitySupplier, final BlockEntityTypeFactory.BlockEntitySupplier - creativePortableGridBlockEntitySupplier + creativePortableGridBlockEntitySupplier, + final BlockEntityTypeFactory.BlockEntitySupplier + diskInterfaceBlockEntitySupplier ) { BlockEntities.INSTANCE.setCable(callback.register( CABLE, @@ -668,7 +671,7 @@ protected final void registerBlockEntities( )); BlockEntities.INSTANCE.setDiskInterface(callback.register( DISK_INTERFACE, - () -> typeFactory.create(DiskInterfaceBlockEntity::new, Blocks.INSTANCE.getDiskInterface().toArray()) + () -> typeFactory.create(diskInterfaceBlockEntitySupplier, Blocks.INSTANCE.getDiskInterface().toArray()) )); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java index d57ce4d97..15e2938c6 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java @@ -17,7 +17,7 @@ import com.refinedmods.refinedstorage2.platform.common.storage.FluidStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.ItemStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; -import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.externalstorage.ExternalStorageBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.portablegrid.AbstractPortableGridBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.storageblock.FluidStorageBlockBlockEntity; @@ -85,7 +85,7 @@ public final class BlockEntities { @Nullable private Supplier> relay; @Nullable - private Supplier> diskInterface; + private Supplier> diskInterface; private BlockEntities() { } @@ -278,11 +278,11 @@ public void setRelay(final Supplier> supplier) this.relay = supplier; } - public BlockEntityType getDiskInterface() { + public BlockEntityType getDiskInterface() { return requireNonNull(diskInterface).get(); } - public void setDiskInterface(final Supplier> supplier) { + public void setDiskInterface(final Supplier> supplier) { this.diskInterface = supplier; } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java index 1324c2e24..2a70dbc4d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java @@ -22,6 +22,7 @@ import com.refinedmods.refinedstorage2.platform.common.storage.FluidStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.ItemStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlock; import com.refinedmods.refinedstorage2.platform.common.storage.externalstorage.ExternalStorageBlock; import com.refinedmods.refinedstorage2.platform.common.storage.portablegrid.PortableGridBlock; @@ -34,10 +35,13 @@ import java.util.EnumMap; import java.util.Map; +import java.util.function.BiFunction; import java.util.function.Supplier; import javax.annotation.Nullable; +import net.minecraft.core.BlockPos; import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.state.BlockState; import static java.util.Objects.requireNonNull; @@ -152,12 +156,8 @@ public final class Blocks { ContentNames.RELAY, COLOR ); - private final BlockColorMap diskInterface = new BlockColorMap<>( - DiskInterfaceBlock::new, - ContentIds.DISK_INTERFACE, - ContentNames.DISK_INTERFACE, - COLOR - ); + @Nullable + private BlockColorMap diskInterface; @Nullable private Supplier quartzEnrichedIronBlock; @@ -320,7 +320,23 @@ public BlockColorMap getRelay() { return relay; } - public BlockColorMap getDiskInterface() { + public BlockColorMap setDiskInterface( + final BiFunction blockEntityFactory + ) { + this.diskInterface = new BlockColorMap<>( + (color, name) -> new DiskInterfaceBlock( + color, + name, + blockEntityFactory + ), + ContentIds.DISK_INTERFACE, + ContentNames.DISK_INTERFACE, + COLOR + ); return diskInterface; } + + public BlockColorMap getDiskInterface() { + return requireNonNull(diskInterface); + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlock.java index 8a15592c9..238f39cbb 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlock.java @@ -1,9 +1,8 @@ package com.refinedmods.refinedstorage2.platform.common.grid; import com.refinedmods.refinedstorage2.platform.common.content.BlockConstants; -import com.refinedmods.refinedstorage2.platform.common.support.AbstractDirectionalBlock; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractActiveColoredDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; -import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; @@ -11,24 +10,12 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.DyeColor; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BooleanProperty; public abstract class AbstractGridBlock & BlockItemProvider, I extends BlockItem> - extends AbstractDirectionalBlock - implements EntityBlock, ColorableBlock { - public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); - - private final MutableComponent name; - private final DyeColor color; - + extends AbstractActiveColoredDirectionalBlock implements EntityBlock { protected AbstractGridBlock(final MutableComponent name, final DyeColor color) { - super(BlockConstants.PROPERTIES); - this.name = name; - this.color = color; + super(BlockConstants.PROPERTIES, color, name); } @Override @@ -36,27 +23,6 @@ protected DirectionType getDirectionType() { return BiDirectionType.INSTANCE; } - @Override - protected BlockState getDefaultState() { - return super.getDefaultState().setValue(ACTIVE, false); - } - - @Override - protected void createBlockStateDefinition(final StateDefinition.Builder builder) { - super.createBlockStateDefinition(builder); - builder.add(ACTIVE); - } - - @Override - public MutableComponent getName() { - return name; - } - - @Override - public DyeColor getColor() { - return color; - } - @Override public boolean canAlwaysConnect() { return true; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java index c2595e952..80debd7ba 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java @@ -4,11 +4,10 @@ import com.refinedmods.refinedstorage2.platform.common.content.BlockConstants; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; import com.refinedmods.refinedstorage2.platform.common.content.Blocks; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractActiveColoredDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBlockEntityTicker; -import com.refinedmods.refinedstorage2.platform.common.support.AbstractDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.BaseBlockItem; import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; -import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeBlockEntityTicker; @@ -21,45 +20,24 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BooleanProperty; import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class RelayBlock extends AbstractDirectionalBlock - implements EntityBlock, ColorableBlock, BlockItemProvider { - public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); - +public class RelayBlock extends AbstractActiveColoredDirectionalBlock + implements EntityBlock, BlockItemProvider { private static final Component HELP = createTranslation("item", "relay.help"); private static final AbstractBlockEntityTicker TICKER = new NetworkNodeBlockEntityTicker<>( BlockEntities.INSTANCE::getRelay, ACTIVE ); - private final MutableComponent name; - private final DyeColor color; - public RelayBlock(final DyeColor color, final MutableComponent name) { - super(BlockConstants.PROPERTIES); - this.name = name; - this.color = color; - } - - @Override - protected BlockState getDefaultState() { - return super.getDefaultState().setValue(ACTIVE, false); - } - - @Override - protected void createBlockStateDefinition(final StateDefinition.Builder builder) { - super.createBlockStateDefinition(builder); - builder.add(ACTIVE); + super(BlockConstants.PROPERTIES, color, name); } @Nullable @@ -90,14 +68,4 @@ public BaseBlockItem createBlockItem() { public BlockColorMap getBlockColorMap() { return Blocks.INSTANCE.getRelay(); } - - @Override - public MutableComponent getName() { - return name; - } - - @Override - public DyeColor getColor() { - return color; - } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java index 4895abeac..270034672 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java @@ -67,4 +67,9 @@ public BlockEntityTicker getTicker(final Level level, final BlockEntityType type) { return TICKER.get(level, type); } + + @Override + public boolean canAlwaysConnect() { + return true; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java index 114e8f100..620ccc29d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java @@ -44,23 +44,12 @@ public void render(final T entity, if (direction == null) { return; } - render(entity, poseStack, vertexConsumers, direction); - } - - private void render(final T entity, - final PoseStack poseStack, - final MultiBufferSource vertexConsumers, - final BiDirection direction) { final Disk[] disks = getDisks(entity); - poseStack.pushPose(); - poseStack.translate(0.5F, 0.5F, 0.5F); - poseStack.mulPose(direction.getQuaternion()); - poseStack.translate(-0.5F, -0.5F, -0.5F); - final VertexConsumer vertexConsumer = vertexConsumers.getBuffer(renderType); if (disks != null) { - renderDiskLeds(poseStack, disks, vertexConsumer); + rotate(poseStack, direction); + renderDiskLeds(poseStack, disks, vertexConsumers.getBuffer(renderType)); + postRotate(poseStack); } - poseStack.popPose(); } private void renderDiskLeds(final PoseStack poseStack, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java similarity index 97% rename from refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlockEntity.java rename to refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java index cccd5f663..f95788cd5 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java @@ -33,9 +33,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; -// TODO models. // TODO: upgradeable + level interacting class hierarchy? Disk Interface is copying stuff now... :( -public class DiskInterfaceBlockEntity extends AbstractDiskContainerBlockEntity +public abstract class AbstractDiskInterfaceBlockEntity + extends AbstractDiskContainerBlockEntity implements StorageTransferListener { public static final int AMOUNT_OF_DISKS = 6; @@ -47,7 +47,7 @@ public class DiskInterfaceBlockEntity extends AbstractDiskContainerBlockEntity + extends AbstractDiskLedBlockEntityRenderer { + private final RenderType renderType; + + protected AbstractDiskInterfaceBlockEntityRenderer(final RenderType renderType) { + this.renderType = renderType; + } + + @Nullable + protected abstract Disk[] getDisks(T blockEntity); + + @Override + public void render(final T entity, + final float tickDelta, + final PoseStack poseStack, + final MultiBufferSource vertexConsumers, + final int light, + final int overlay) { + final Level level = entity.getLevel(); + if (level == null) { + return; + } + final BlockState blockState = level.getBlockState(entity.getBlockPos()); + if (!(blockState.getBlock() instanceof DiskInterfaceBlock diskInterfaceBlock)) { + return; + } + final BiDirection direction = diskInterfaceBlock.getDirection(blockState); + if (direction == null) { + return; + } + final Disk[] disks = getDisks(entity); + if (disks != null) { + rotate(poseStack, direction); + renderDiskLeds(poseStack, disks, vertexConsumers.getBuffer(renderType)); + postRotate(poseStack); + } + } + + private void renderDiskLeds(final PoseStack poseStack, + final Disk[] disks, + final VertexConsumer vertexConsumer) { + for (int i = 0; i < 6; ++i) { + final int x = i < 3 ? 0 : 1; + final int y = i % 3; + final Disk disk = disks[i]; + renderLed(poseStack, vertexConsumer, 10 - (x * 7), 8 - (y * 3), -1, disk, Direction.SOUTH); + } + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlock.java index 7f84f5a27..c1035995b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceBlock.java @@ -14,6 +14,7 @@ import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; +import java.util.function.BiFunction; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; @@ -33,11 +34,17 @@ public class DiskInterfaceBlock extends AbstractActiveColoredDirectionalBlock implements EntityBlock, BlockItemProvider { private static final Component HELP = createTranslation("item", "disk_interface.help"); - private static final DiskContainerBlockEntityTicker TICKER = - new DiskContainerBlockEntityTicker<>(BlockEntities.INSTANCE::getDiskInterface, ACTIVE); + private static final DiskContainerBlockEntityTicker + TICKER = new DiskContainerBlockEntityTicker<>(BlockEntities.INSTANCE::getDiskInterface, ACTIVE); - public DiskInterfaceBlock(final DyeColor color, final MutableComponent name) { + private final BiFunction blockEntityFactory; + + public DiskInterfaceBlock(final DyeColor color, + final MutableComponent name, + final BiFunction + blockEntityFactory) { super(BlockConstants.PROPERTIES, color, name); + this.blockEntityFactory = blockEntityFactory; } @Override @@ -56,7 +63,7 @@ public BlockEntityTicker getTicker(final Level level, @Nullable @Override public BlockEntity newBlockEntity(final BlockPos blockPos, final BlockState blockState) { - return new DiskInterfaceBlockEntity(blockPos, blockState); + return blockEntityFactory.apply(blockPos, blockState); } @Override @@ -68,4 +75,9 @@ public BlockColorMap getBlockColorMap() { public BaseBlockItem createBlockItem() { return new NetworkNodeBlockItem(this, HELP); } + + @Override + public boolean canAlwaysConnect() { + return true; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceContainerMenu.java index 67746631f..6ebe012eb 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskinterface/DiskInterfaceContainerMenu.java @@ -38,7 +38,7 @@ public class DiskInterfaceContainerMenu extends AbstractResourceContainerMenu { DiskInterfaceContainerMenu(final int syncId, final Player player, - final DiskInterfaceBlockEntity blockEntity, + final AbstractDiskInterfaceBlockEntity blockEntity, final DiskInventory diskInventory, final ResourceContainer filterContainer, final UpgradeContainer upgradeContainer) { @@ -70,7 +70,10 @@ public DiskInterfaceContainerMenu(final int syncId, final Inventory playerInvent super(Menus.INSTANCE.getDiskInterface(), syncId); addSlots( playerInventory.player, - new FilteredContainer(DiskInterfaceBlockEntity.AMOUNT_OF_DISKS, StorageContainerItem.stackValidator()), + new FilteredContainer( + AbstractDiskInterfaceBlockEntity.AMOUNT_OF_DISKS, + StorageContainerItem.stackValidator() + ), ResourceContainerImpl.createForFilter(), new UpgradeContainer(UpgradeDestinations.DISK_INTERFACE, PlatformApi.INSTANCE.getUpgradeRegistry()) ); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractActiveColoredDirectionalBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractActiveColoredDirectionalBlock.java index 9650205f8..7499f91ab 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractActiveColoredDirectionalBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractActiveColoredDirectionalBlock.java @@ -46,9 +46,4 @@ public DyeColor getColor() { public MutableComponent getName() { return name; } - - @Override - public boolean canAlwaysConnect() { - return true; - } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/render/AbstractDiskLedBlockEntityRenderer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/render/AbstractDiskLedBlockEntityRenderer.java index 47e132420..2dfdb68c1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/render/AbstractDiskLedBlockEntityRenderer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/render/AbstractDiskLedBlockEntityRenderer.java @@ -2,6 +2,7 @@ import com.refinedmods.refinedstorage2.api.storage.StorageState; import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; @@ -47,4 +48,15 @@ private int getColor(final StorageState state) { case FULL -> 0xDA4B40; }; } + + protected static void rotate(final PoseStack poseStack, final BiDirection direction) { + poseStack.pushPose(); + poseStack.translate(0.5F, 0.5F, 0.5F); + poseStack.mulPose(direction.getQuaternion()); + poseStack.translate(-0.5F, -0.5F, -0.5F); + } + + protected static void postRotate(final PoseStack poseStack) { + poseStack.popPose(); + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/SchedulingModeSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/SchedulingModeSideButtonWidget.java index 442e9382e..cf0a051d1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/SchedulingModeSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/SchedulingModeSideButtonWidget.java @@ -8,8 +8,6 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; - -// TODO: icons . public class SchedulingModeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "scheduling_mode"); @@ -34,12 +32,16 @@ private static SchedulingModeType toggle(final SchedulingModeType modeSettings) @Override protected int getXTexture() { - return -16; + return switch (property.getValue()) { + case DEFAULT -> 0; + case ROUND_ROBIN -> 16; + case RANDOM -> 32; + }; } @Override protected int getYTexture() { - return -16; + return 144; } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java index c3fb469b9..a9ccf755a 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java @@ -4,11 +4,10 @@ import com.refinedmods.refinedstorage2.platform.common.content.BlockConstants; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; import com.refinedmods.refinedstorage2.platform.common.content.Blocks; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractActiveColoredDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBlockEntityTicker; -import com.refinedmods.refinedstorage2.platform.common.support.AbstractDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.BaseBlockItem; import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; -import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.NetworkNodeBlockItem; import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; @@ -23,25 +22,20 @@ import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; -public class WirelessTransmitterBlock extends AbstractDirectionalBlock - implements ColorableBlock, BlockItemProvider, - EntityBlock { - public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); - +public class WirelessTransmitterBlock + extends AbstractActiveColoredDirectionalBlock + implements BlockItemProvider, EntityBlock { private static final AbstractBlockEntityTicker TICKER = new NetworkNodeBlockEntityTicker<>(BlockEntities.INSTANCE::getWirelessTransmitter, ACTIVE); private static final Component HELP = createTranslation("item", "wireless_transmitter.help"); @@ -53,24 +47,8 @@ public class WirelessTransmitterBlock extends AbstractDirectionalBlock builder) { - super.createBlockStateDefinition(builder); - builder.add(ACTIVE); + super(BlockConstants.PROPERTIES, color, name); } @Override @@ -117,16 +95,6 @@ public BlockEntityTicker getTicker(final Level level, return TICKER.get(level, type); } - @Override - public DyeColor getColor() { - return color; - } - - @Override - public MutableComponent getName() { - return name; - } - @Override public BaseBlockItem createBlockItem() { return new NetworkNodeBlockItem(this, HELP); diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/back.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/back.png new file mode 100644 index 000000000..fb5815576 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/back.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/black.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/black.png new file mode 100644 index 000000000..391bbcd57 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/black.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/blue.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/blue.png new file mode 100644 index 000000000..edeffbcf9 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/blue.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/brown.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/brown.png new file mode 100644 index 000000000..016dd7b4b Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/brown.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/cyan.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/cyan.png new file mode 100644 index 000000000..cbd0c734c Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/cyan.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/gray.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/gray.png new file mode 100644 index 000000000..bd1182722 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/gray.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/green.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/green.png new file mode 100644 index 000000000..59d0b8015 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/green.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/inactive.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/inactive.png new file mode 100644 index 000000000..6e6d6facf Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/inactive.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/light_blue.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/light_blue.png new file mode 100644 index 000000000..5558434a4 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/light_blue.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/light_gray.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/light_gray.png new file mode 100644 index 000000000..bfbaabf99 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/light_gray.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/lime.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/lime.png new file mode 100644 index 000000000..501ea563b Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/lime.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/magenta.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/magenta.png new file mode 100644 index 000000000..2a03a5e3d Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/magenta.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/orange.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/orange.png new file mode 100644 index 000000000..2498383c2 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/orange.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/pink.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/pink.png new file mode 100644 index 000000000..9ae870552 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/pink.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/purple.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/purple.png new file mode 100644 index 000000000..ac34cbef0 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/purple.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/red.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/red.png new file mode 100644 index 000000000..caf5c5a28 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/red.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/white.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/white.png new file mode 100644 index 000000000..40faad586 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/white.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/yellow.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/yellow.png new file mode 100644 index 000000000..65bab549a Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/cutouts/yellow.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/front.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/front.png new file mode 100644 index 000000000..faf04c29e Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/front.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/left.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/left.png new file mode 100644 index 000000000..fb5815576 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/left.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/right.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/right.png new file mode 100644 index 000000000..fb5815576 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/right.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/top.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/top.png new file mode 100644 index 000000000..fb5815576 Binary files /dev/null and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/disk_interface/top.png differ diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/icons.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/icons.png index 2a5d67b2e..39ec1ea00 100644 Binary files a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/icons.png and b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/icons.png differ diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java index 99f2fcd81..c6ba35785 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java @@ -22,6 +22,7 @@ import com.refinedmods.refinedstorage2.platform.common.support.tooltip.ResourceClientTooltipComponent; import com.refinedmods.refinedstorage2.platform.common.upgrade.RegulatorUpgradeItem; import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeDestinationClientTooltipComponent; +import com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil; import com.refinedmods.refinedstorage2.platform.fabric.mixin.ItemPropertiesAccessor; import com.refinedmods.refinedstorage2.platform.fabric.packet.s2c.EnergyInfoPacket; import com.refinedmods.refinedstorage2.platform.fabric.packet.s2c.GridActivePacket; @@ -34,6 +35,8 @@ import com.refinedmods.refinedstorage2.platform.fabric.packet.s2c.WirelessTransmitterRangePacket; import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.DiskDriveBlockEntityRendererImpl; import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.DiskDriveUnbakedModel; +import com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface.DiskInterfaceBlockEntityRendererImpl; +import com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface.DiskInterfaceUnbakedModel; import com.refinedmods.refinedstorage2.platform.fabric.storage.portablegrid.PortableGridBlockEntityRendererImpl; import com.refinedmods.refinedstorage2.platform.fabric.storage.portablegrid.PortableGridUnbakedModel; import com.refinedmods.refinedstorage2.platform.fabric.support.render.EmissiveModelRegistry; @@ -111,6 +114,7 @@ private void setRenderLayers() { setCutout(Blocks.INSTANCE.getCreativePortableGrid()); setCutout(Blocks.INSTANCE.getSecurityManager()); setCutout(Blocks.INSTANCE.getRelay()); + setCutout(Blocks.INSTANCE.getDiskInterface()); } private void setCutout(final BlockColorMap blockMap) { @@ -342,25 +346,56 @@ private void registerBlockEntityRenderers() { BlockEntities.INSTANCE.getCreativePortableGrid(), ctx -> new PortableGridBlockEntityRendererImpl<>() ); + BlockEntityRenderers.register( + BlockEntities.INSTANCE.getDiskInterface(), + ctx -> new DiskInterfaceBlockEntityRendererImpl<>() + ); } private void registerCustomModels() { registerDiskModels(); + final QuadRotators quadRotators = new QuadRotators(); + ModelLoadingPlugin.register(pluginContext -> { + registerCustomDiskDriveModels(pluginContext, quadRotators); + registerCustomDiskInterfaceModels(pluginContext, quadRotators); + registerCustomPortableGridModels(pluginContext, quadRotators); + }); + } - final ResourceLocation diskDriveIdentifier = createIdentifier("block/disk_drive"); - final ResourceLocation diskDriveIdentifierItem = createIdentifier("item/disk_drive"); + private void registerCustomDiskInterfaceModels(final ModelLoadingPlugin.Context pluginContext, + final QuadRotators quadRotators) { + pluginContext.resolveModel().register(context -> { + if (context.id().getNamespace().equals(IdentifierUtil.MOD_ID) + && context.id().getPath().startsWith("item/") + && context.id().getPath().endsWith("disk_interface")) { + final boolean isDefault = !context.id().getPath().endsWith("_disk_interface"); + final DyeColor color = isDefault + ? Blocks.INSTANCE.getDiskInterface().getDefault().getColor() + : DyeColor.byName(context.id().getPath().replace("_disk_interface", "") + .replace("item/", ""), Blocks.INSTANCE.getDiskInterface().getDefault().getColor()); + return new DiskInterfaceUnbakedModel(quadRotators, color); + } + if (context.id().getNamespace().equals(IdentifierUtil.MOD_ID) + && context.id().getPath().startsWith("block/disk_interface/") + && !context.id().getPath().startsWith("block/disk_interface/base_") + && !context.id().getPath().equals("block/disk_interface/inactive")) { + final DyeColor color = DyeColor.byName( + context.id().getPath().replace("block/disk_interface/", ""), + Blocks.INSTANCE.getDiskInterface().getDefault().getColor() + ); + return new DiskInterfaceUnbakedModel(quadRotators, color); + } + return null; + }); + } + private void registerCustomPortableGridModels(final ModelLoadingPlugin.Context pluginContext, + final QuadRotators quadRotators) { final ResourceLocation portableGridIdentifier = createIdentifier("block/portable_grid"); final ResourceLocation portableGridIdentifierItem = createIdentifier("item/portable_grid"); final ResourceLocation creativePortableGridIdentifier = createIdentifier("block/creative_portable_grid"); final ResourceLocation creativePortableGridIdentifierItem = createIdentifier("item/creative_portable_grid"); - - final QuadRotators quadRotators = new QuadRotators(); - - ModelLoadingPlugin.register(pluginContext -> pluginContext.resolveModel().register(context -> { - if (context.id().equals(diskDriveIdentifier) || context.id().equals(diskDriveIdentifierItem)) { - return new DiskDriveUnbakedModel(quadRotators); - } + pluginContext.resolveModel().register(context -> { if (context.id().equals(portableGridIdentifier) || context.id().equals(portableGridIdentifierItem) || context.id().equals(creativePortableGridIdentifier) @@ -368,7 +403,19 @@ private void registerCustomModels() { return new PortableGridUnbakedModel(quadRotators); } return null; - })); + }); + } + + private void registerCustomDiskDriveModels(final ModelLoadingPlugin.Context pluginContext, + final QuadRotators quadRotators) { + final ResourceLocation diskDriveIdentifier = createIdentifier("block/disk_drive"); + final ResourceLocation diskDriveIdentifierItem = createIdentifier("item/disk_drive"); + pluginContext.resolveModel().register(context -> { + if (context.id().equals(diskDriveIdentifier) || context.id().equals(diskDriveIdentifierItem)) { + return new DiskDriveUnbakedModel(quadRotators); + } + return null; + }); } private void registerCustomTooltips() { diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java index 7214b9514..0a832563e 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ModInitializerImpl.java @@ -19,7 +19,7 @@ import com.refinedmods.refinedstorage2.platform.common.security.FallbackSecurityCardItem; import com.refinedmods.refinedstorage2.platform.common.security.SecurityCardItem; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; -import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.portablegrid.PortableGridBlockItem; import com.refinedmods.refinedstorage2.platform.common.storage.portablegrid.PortableGridType; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseBlock; @@ -51,6 +51,7 @@ import com.refinedmods.refinedstorage2.platform.fabric.packet.c2s.UseNetworkBoundItemPacket; import com.refinedmods.refinedstorage2.platform.fabric.security.NetworkNodeBreakSecurityEventListener; import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.FabricDiskDriveBlockEntity; +import com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface.FabricDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.fabric.storage.externalstorage.FabricStoragePlatformExternalStorageProviderFactory; import com.refinedmods.refinedstorage2.platform.fabric.storage.portablegrid.FabricPortableGridBlockEntity; import com.refinedmods.refinedstorage2.platform.fabric.support.energy.EnergyStorageAdapter; @@ -222,7 +223,8 @@ private void registerContent() { new DirectRegistryCallback<>(BuiltInRegistries.BLOCK), FabricDiskDriveBlockEntity::new, (pos, state) -> new FabricPortableGridBlockEntity(PortableGridType.NORMAL, pos, state), - (pos, state) -> new FabricPortableGridBlockEntity(PortableGridType.CREATIVE, pos, state) + (pos, state) -> new FabricPortableGridBlockEntity(PortableGridType.CREATIVE, pos, state), + FabricDiskInterfaceBlockEntity::new ); final DirectRegistryCallback itemRegistryCallback = new DirectRegistryCallback<>(BuiltInRegistries.ITEM); registerItems(itemRegistryCallback); @@ -240,7 +242,8 @@ public BlockEntityType create(final BlockEntitySuppli }, FabricDiskDriveBlockEntity::new, (pos, state) -> new FabricPortableGridBlockEntity(PortableGridType.NORMAL, pos, state), - (pos, state) -> new FabricPortableGridBlockEntity(PortableGridType.CREATIVE, pos, state) + (pos, state) -> new FabricPortableGridBlockEntity(PortableGridType.CREATIVE, pos, state), + FabricDiskInterfaceBlockEntity::new ); registerMenus(new DirectRegistryCallback<>(BuiltInRegistries.MENU), new MenuTypeFactory() { @Override @@ -397,7 +400,7 @@ private void registerSidedHandlers() { ItemStorage.SIDED.registerForBlockEntity((blockEntity, context) -> { final InventoryStorage storage = InventoryStorage.of(blockEntity.getDiskInventory(), context); final List> parts = new ArrayList<>(); - for (int i = 0; i < DiskInterfaceBlockEntity.AMOUNT_OF_DISKS; ++i) { + for (int i = 0; i < AbstractDiskInterfaceBlockEntity.AMOUNT_OF_DISKS; ++i) { final var slot = storage.getSlot(i); parts.add(i < 3 ? FilteringStorage.insertOnlyOf(slot) : FilteringStorage.extractOnlyOf(slot)); } diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/AbstractDiskContainerBakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/AbstractDiskContainerBakedModel.java new file mode 100644 index 000000000..1294a3911 --- /dev/null +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/AbstractDiskContainerBakedModel.java @@ -0,0 +1,116 @@ +package com.refinedmods.refinedstorage2.platform.fabric.storage; + +import com.refinedmods.refinedstorage2.api.storage.StorageState; +import com.refinedmods.refinedstorage2.platform.common.storage.AbstractDiskContainerBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadTranslator; + +import java.util.Map; +import java.util.function.Supplier; +import javax.annotation.Nullable; + +import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; +import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +public abstract class AbstractDiskContainerBakedModel extends ForwardingBakedModel { + private final Map diskModels; + private final BakedModel inactiveLedModel; + private final QuadTranslator[] diskTranslations; + + protected AbstractDiskContainerBakedModel(final Map diskModels, + final BakedModel inactiveLedModel, + final QuadTranslator[] diskTranslations) { + this.diskModels = diskModels; + this.inactiveLedModel = inactiveLedModel; + this.diskTranslations = diskTranslations; + } + + @Override + public boolean isVanillaAdapter() { + return false; + } + + @Override + public void emitBlockQuads(final BlockAndTintGetter blockView, + final BlockState state, + final BlockPos pos, + final Supplier randomSupplier, + final RenderContext context) { + final Object renderAttachment = blockView.getBlockEntityRenderData(pos); + if (renderAttachment instanceof Disk[] disks) { + emitDiskQuads(blockView, state, pos, randomSupplier, context, disks); + } + } + + @Override + public void emitItemQuads(final ItemStack stack, + final Supplier randomSupplier, + final RenderContext context) { + final CompoundTag tag = BlockItem.getBlockEntityData(stack); + if (tag == null) { + return; + } + for (int i = 0; i < diskTranslations.length; ++i) { + final Item diskItem = AbstractDiskContainerBlockEntity.getDisk(tag, i); + emitDiskQuads(stack, randomSupplier, context, diskItem, i); + } + } + + private void emitDiskQuads(final BlockAndTintGetter blockView, + final BlockState state, + final BlockPos pos, + final Supplier randomSupplier, + final RenderContext context, + final Disk[] disks) { + for (int i = 0; i < diskTranslations.length; ++i) { + final Disk disk = disks[i]; + emitDiskQuads(blockView, state, pos, randomSupplier, context, disk, i); + } + } + + private void emitDiskQuads(final BlockAndTintGetter blockView, + final BlockState state, + final BlockPos pos, + final Supplier randomSupplier, + final RenderContext context, + final Disk disk, + final int index) { + if (disk.state() == StorageState.NONE) { + return; + } + final BakedModel model = diskModels.get(disk.item()); + if (model == null) { + return; + } + context.pushTransform(diskTranslations[index]); + model.emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + + private void emitDiskQuads(final ItemStack stack, + final Supplier randomSupplier, + final RenderContext context, + @Nullable final Item diskItem, + final int index) { + if (diskItem == null) { + return; + } + final BakedModel diskModel = diskModels.get(diskItem); + if (diskModel == null) { + return; + } + context.pushTransform(diskTranslations[index]); + diskModel.emitItemQuads(stack, randomSupplier, context); + inactiveLedModel.emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java index 0be51b0f9..9b4765a14 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java @@ -1,58 +1,48 @@ package com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.storage.StorageState; -import com.refinedmods.refinedstorage2.platform.common.storage.Disk; -import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; +import com.refinedmods.refinedstorage2.platform.fabric.storage.AbstractDiskContainerBakedModel; import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadRotators; import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadTranslator; import java.util.Map; import java.util.function.Supplier; -import javax.annotation.Nullable; -import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.util.RandomSource; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; -class DiskDriveBakedModel extends ForwardingBakedModel { - private final Map diskModels; - private final BakedModel inactiveLedModel; +class DiskDriveBakedModel extends AbstractDiskContainerBakedModel { private final QuadRotators quadRotators; - private final QuadTranslator[] diskTranslations = new QuadTranslator[8]; DiskDriveBakedModel(final BakedModel baseModel, final Map diskModels, final BakedModel inactiveLedModel, final QuadRotators quadRotators) { + super(diskModels, inactiveLedModel, getDiskTranslations()); this.wrapped = baseModel; - this.diskModels = diskModels; - this.inactiveLedModel = inactiveLedModel; this.quadRotators = quadRotators; + } + + private static QuadTranslator[] getDiskTranslations() { + final QuadTranslator[] translations = new QuadTranslator[8]; int i = 0; for (int y = 0; y < 4; ++y) { for (int x = 0; x < 2; ++x) { - diskTranslations[i++] = new QuadTranslator( + translations[i++] = new QuadTranslator( x == 0 ? -(2F / 16F) : -(9F / 16F), -((y * 3F) / 16F) - (2F / 16F), 0 ); } } - } - - @Override - public boolean isVanillaAdapter() { - return false; + return translations; } @Override @@ -60,14 +50,7 @@ public void emitItemQuads(final ItemStack stack, final Supplier randomSupplier, final RenderContext context) { wrapped.emitItemQuads(stack, randomSupplier, context); - final CompoundTag tag = BlockItem.getBlockEntityData(stack); - if (tag == null) { - return; - } - for (int i = 0; i < diskTranslations.length; ++i) { - final Item diskItem = AbstractDiskDriveBlockEntity.getDisk(tag, i); - emitDiskQuads(stack, randomSupplier, context, diskItem, i); - } + super.emitItemQuads(stack, randomSupplier, context); } @Override @@ -84,61 +67,8 @@ public void emitBlockQuads(final BlockAndTintGetter blockView, return; } context.pushTransform(quadRotators.forDirection(direction)); + wrapped.emitBlockQuads(blockView, state, pos, randomSupplier, context); super.emitBlockQuads(blockView, state, pos, randomSupplier, context); - final Object renderAttachment = blockView.getBlockEntityRenderData(pos); - if (renderAttachment instanceof Disk[] disks) { - emitDiskQuads(blockView, state, pos, randomSupplier, context, disks); - } - context.popTransform(); - } - - private void emitDiskQuads(final BlockAndTintGetter blockView, - final BlockState state, - final BlockPos pos, - final Supplier randomSupplier, - final RenderContext context, - final Disk[] disks) { - for (int i = 0; i < diskTranslations.length; ++i) { - final Disk disk = disks[i]; - emitDiskQuads(blockView, state, pos, randomSupplier, context, disk, i); - } - } - - private void emitDiskQuads(final BlockAndTintGetter blockView, - final BlockState state, - final BlockPos pos, - final Supplier randomSupplier, - final RenderContext context, - final Disk disk, - final int index) { - if (disk.state() == StorageState.NONE) { - return; - } - final BakedModel model = diskModels.get(disk.item()); - if (model == null) { - return; - } - context.pushTransform(diskTranslations[index]); - model.emitBlockQuads(blockView, state, pos, randomSupplier, context); - context.popTransform(); - } - - - private void emitDiskQuads(final ItemStack stack, - final Supplier randomSupplier, - final RenderContext context, - @Nullable final Item diskItem, - final int index) { - if (diskItem == null) { - return; - } - final BakedModel diskModel = diskModels.get(diskItem); - if (diskModel == null) { - return; - } - context.pushTransform(diskTranslations[index]); - diskModel.emitItemQuads(stack, randomSupplier, context); - inactiveLedModel.emitItemQuads(stack, randomSupplier, context); context.popTransform(); } } diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBlockEntityRendererImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBlockEntityRendererImpl.java index 62b658e3a..0050dc78f 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBlockEntityRendererImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBlockEntityRendererImpl.java @@ -13,10 +13,10 @@ public DiskDriveBlockEntityRendererImpl() { @Override protected Disk[] getDisks(final AbstractDiskDriveBlockEntity blockEntity) { - if (!(blockEntity instanceof FabricDiskDriveBlockEntity fabricDiskDriveBlockEntity)) { + if (!(blockEntity instanceof FabricDiskDriveBlockEntity fabricBlockEntity)) { return null; } - if (fabricDiskDriveBlockEntity.getRenderData() instanceof Disk[] disks) { + if (fabricBlockEntity.getRenderData() instanceof Disk[] disks) { return disks; } return null; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceBakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceBakedModel.java new file mode 100644 index 000000000..a1bc278a1 --- /dev/null +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceBakedModel.java @@ -0,0 +1,92 @@ +package com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlock; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractActiveColoredDirectionalBlock; +import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; +import com.refinedmods.refinedstorage2.platform.fabric.storage.AbstractDiskContainerBakedModel; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.EmissiveTransform; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadRotators; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadTranslator; + +import java.util.Map; +import java.util.Set; +import java.util.function.Supplier; + +import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +class DiskInterfaceBakedModel extends AbstractDiskContainerBakedModel { + private final BakedModel inactiveModel; + private final QuadRotators quadRotators; + private final EmissiveTransform emissiveTransform; + + DiskInterfaceBakedModel(final BakedModel baseModel, + final BakedModel inactiveModel, + final Map diskModels, + final BakedModel inactiveLedModel, + final QuadRotators quadRotators, + final ResourceLocation emissiveSprite) { + super(diskModels, inactiveLedModel, getDiskTranslations()); + this.wrapped = baseModel; + this.inactiveModel = inactiveModel; + this.quadRotators = quadRotators; + this.emissiveTransform = new EmissiveTransform(Set.of(emissiveSprite)); + } + + private static QuadTranslator[] getDiskTranslations() { + final QuadTranslator[] translations = new QuadTranslator[6]; + for (int i = 0; i < translations.length; ++i) { + final int x = i < 3 ? 0 : 1; + final int y = i % 3; + translations[i] = new QuadTranslator( + x == 0 ? -(2F / 16F) : -(9F / 16F), + -((y * 3F) / 16F) - (6F / 16F), + 0 + ); + } + return translations; + } + + @Override + public void emitItemQuads(final ItemStack stack, + final Supplier randomSupplier, + final RenderContext context) { + context.pushTransform(emissiveTransform); + wrapped.emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + super.emitItemQuads(stack, randomSupplier, context); + } + + @Override + public void emitBlockQuads(final BlockAndTintGetter blockView, + final BlockState state, + final BlockPos pos, + final Supplier randomSupplier, + final RenderContext context) { + if (!(state.getBlock() instanceof DiskInterfaceBlock diskInterfaceBlock)) { + return; + } + final BiDirection direction = diskInterfaceBlock.getDirection(state); + if (direction == null) { + return; + } + context.pushTransform(quadRotators.forDirection(direction)); + final boolean active = state.getValue(AbstractActiveColoredDirectionalBlock.ACTIVE); + if (active) { + context.pushTransform(emissiveTransform); + } + (active ? wrapped : inactiveModel).emitBlockQuads(blockView, state, pos, randomSupplier, context); + super.emitBlockQuads(blockView, state, pos, randomSupplier, context); + if (active) { + context.popTransform(); + } + context.popTransform(); + } +} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceBlockEntityRendererImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceBlockEntityRendererImpl.java new file mode 100644 index 000000000..4a62ebca9 --- /dev/null +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceBlockEntityRendererImpl.java @@ -0,0 +1,24 @@ +package com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntityRenderer; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.RenderTypes; + +public class DiskInterfaceBlockEntityRendererImpl + extends AbstractDiskInterfaceBlockEntityRenderer { + public DiskInterfaceBlockEntityRendererImpl() { + super(RenderTypes.DISK_LED); + } + + @Override + protected Disk[] getDisks(final AbstractDiskInterfaceBlockEntity blockEntity) { + if (!(blockEntity instanceof FabricDiskInterfaceBlockEntity fabricBlockEntity)) { + return null; + } + if (fabricBlockEntity.getRenderData() instanceof Disk[] disks) { + return disks; + } + return null; + } +} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceUnbakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceUnbakedModel.java new file mode 100644 index 000000000..e319153c1 --- /dev/null +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/DiskInterfaceUnbakedModel.java @@ -0,0 +1,84 @@ +package com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.fabric.support.render.QuadRotators; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.Material; +import net.minecraft.client.resources.model.ModelBaker; +import net.minecraft.client.resources.model.ModelState; +import net.minecraft.client.resources.model.UnbakedModel; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.Item; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; +import static java.util.Objects.requireNonNull; + +public class DiskInterfaceUnbakedModel implements UnbakedModel { + private static final ResourceLocation INACTIVE_MODEL = createIdentifier("block/disk_interface/inactive"); + private static final ResourceLocation LED_INACTIVE_MODEL = createIdentifier("block/disk/led_inactive"); + + private final QuadRotators quadRotators; + private final ResourceLocation baseModel; + private final ResourceLocation emissiveSprite; + + public DiskInterfaceUnbakedModel(final QuadRotators quadRotators, final DyeColor color) { + this.quadRotators = quadRotators; + this.baseModel = createIdentifier("block/disk_interface/base_" + color.getName()); + this.emissiveSprite = createIdentifier("block/disk_interface/cutouts/" + color.getName()); + } + + @Override + public Collection getDependencies() { + final Set dependencies = new HashSet<>(); + dependencies.add(baseModel); + dependencies.add(INACTIVE_MODEL); + dependencies.add(LED_INACTIVE_MODEL); + dependencies.addAll(PlatformApi.INSTANCE.getStorageContainerItemHelper().getDiskModels()); + return dependencies; + } + + @Override + public void resolveParents(final Function modelGetter) { + modelGetter.apply(baseModel).resolveParents(modelGetter); + modelGetter.apply(INACTIVE_MODEL).resolveParents(modelGetter); + PlatformApi.INSTANCE.getStorageContainerItemHelper().getDiskModels().forEach( + diskModel -> modelGetter.apply(diskModel).resolveParents(modelGetter) + ); + modelGetter.apply(LED_INACTIVE_MODEL).resolveParents(modelGetter); + } + + @Nullable + @Override + public BakedModel bake(final ModelBaker baker, + final Function spriteGetter, + final ModelState state, + final ResourceLocation location) { + final Map diskModels = PlatformApi.INSTANCE.getStorageContainerItemHelper() + .getDiskModelsByItem() + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, + entry -> requireNonNull(baker.bake(entry.getValue(), state)) + )); + return new DiskInterfaceBakedModel( + requireNonNull(baker.bake(baseModel, state)), + requireNonNull(baker.bake(INACTIVE_MODEL, state)), + diskModels, + requireNonNull(baker.bake(LED_INACTIVE_MODEL, state)), + quadRotators, + emissiveSprite + ); + } +} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/FabricDiskInterfaceBlockEntity.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/FabricDiskInterfaceBlockEntity.java new file mode 100644 index 000000000..30370e0be --- /dev/null +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/FabricDiskInterfaceBlockEntity.java @@ -0,0 +1,20 @@ +package com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; + +import javax.annotation.Nullable; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; + +public class FabricDiskInterfaceBlockEntity extends AbstractDiskInterfaceBlockEntity { + public FabricDiskInterfaceBlockEntity(final BlockPos pos, final BlockState state) { + super(pos, state); + } + + @Override + @Nullable + public Object getRenderData() { + return disks; + } +} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/package-info.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/package-info.java new file mode 100644 index 000000000..2e7c72336 --- /dev/null +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskinterface/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage2.platform.fabric.storage.diskinterface; + +import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java index c87fc09b0..fc482524b 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/render/EmissiveTransform.java @@ -11,10 +11,10 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; -class EmissiveTransform implements RenderContext.QuadTransform { +public class EmissiveTransform implements RenderContext.QuadTransform { private final Set emissiveSprites; - EmissiveTransform(final Set emissiveSprites) { + public EmissiveTransform(final Set emissiveSprites) { this.emissiveSprites = emissiveSprites; } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java index 1ec7e7b94..4c2983c95 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ClientModInitializer.java @@ -6,6 +6,7 @@ import com.refinedmods.refinedstorage2.platform.common.AbstractClientModInitializer; import com.refinedmods.refinedstorage2.platform.common.configurationcard.ConfigurationCardItemPropertyFunction; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; +import com.refinedmods.refinedstorage2.platform.common.content.Blocks; import com.refinedmods.refinedstorage2.platform.common.content.ContentNames; import com.refinedmods.refinedstorage2.platform.common.content.Items; import com.refinedmods.refinedstorage2.platform.common.content.KeyMappings; @@ -21,6 +22,8 @@ import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeDestinationClientTooltipComponent; import com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive.DiskDriveBlockEntityRendererImpl; import com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive.DiskDriveGeometryLoader; +import com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface.DiskInterfaceBlockEntityRendererImpl; +import com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface.DiskInterfaceGeometryLoader; import com.refinedmods.refinedstorage2.platform.forge.storage.portablegrid.PortableGridBlockEntityRendererImpl; import com.refinedmods.refinedstorage2.platform.forge.storage.portablegrid.PortableGridGeometryLoader; @@ -85,6 +88,9 @@ public static void onRegisterModelGeometry(final ModelEvent.RegisterGeometryLoad registerDiskModels(); e.register(DISK_DRIVE, new DiskDriveGeometryLoader()); e.register(PORTABLE_GRID, new PortableGridGeometryLoader()); + Blocks.INSTANCE.getDiskInterface().forEach( + (color, id, supplier) -> e.register(id, new DiskInterfaceGeometryLoader(color)) + ); } @SubscribeEvent @@ -157,6 +163,10 @@ private static void registerBlockEntityRenderer() { BlockEntities.INSTANCE.getCreativePortableGrid(), ctx -> new PortableGridBlockEntityRendererImpl<>() ); + BlockEntityRenderers.register( + BlockEntities.INSTANCE.getDiskInterface(), + ctx -> new DiskInterfaceBlockEntityRendererImpl<>() + ); } @SubscribeEvent diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java index dda6112ce..d2893a554 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java @@ -17,7 +17,7 @@ import com.refinedmods.refinedstorage2.platform.common.iface.InterfacePlatformExternalStorageProviderFactory; import com.refinedmods.refinedstorage2.platform.common.security.FallbackSecurityCardItem; import com.refinedmods.refinedstorage2.platform.common.security.SecurityCardItem; -import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.portablegrid.PortableGridBlockItem; import com.refinedmods.refinedstorage2.platform.common.storage.portablegrid.PortableGridType; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseBlock; @@ -34,6 +34,7 @@ import com.refinedmods.refinedstorage2.platform.forge.importer.FluidHandlerImporterTransferStrategyFactory; import com.refinedmods.refinedstorage2.platform.forge.importer.ItemHandlerImporterTransferStrategyFactory; import com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive.ForgeDiskDriveBlockEntity; +import com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface.ForgeDiskInterfaceBlockEntity; import com.refinedmods.refinedstorage2.platform.forge.storage.externalstorage.FluidHandlerPlatformExternalStorageProviderFactory; import com.refinedmods.refinedstorage2.platform.forge.storage.externalstorage.ItemHandlerPlatformExternalStorageProviderFactory; import com.refinedmods.refinedstorage2.platform.forge.storage.portablegrid.ForgePortableGridBlockEntity; @@ -217,7 +218,8 @@ private void registerBlocks(final IEventBus eventBus) { new ForgeRegistryCallback<>(blockRegistry), ForgeDiskDriveBlockEntity::new, (pos, state) -> new ForgePortableGridBlockEntity(PortableGridType.NORMAL, pos, state), - (pos, state) -> new ForgePortableGridBlockEntity(PortableGridType.CREATIVE, pos, state) + (pos, state) -> new ForgePortableGridBlockEntity(PortableGridType.CREATIVE, pos, state), + ForgeDiskInterfaceBlockEntity::new ); blockRegistry.register(eventBus); } @@ -313,7 +315,8 @@ public BlockEntityType create(final BlockEntitySuppli }, ForgeDiskDriveBlockEntity::new, (pos, state) -> new ForgePortableGridBlockEntity(PortableGridType.NORMAL, pos, state), - (pos, state) -> new ForgePortableGridBlockEntity(PortableGridType.CREATIVE, pos, state) + (pos, state) -> new ForgePortableGridBlockEntity(PortableGridType.CREATIVE, pos, state), + ForgeDiskInterfaceBlockEntity::new ); blockEntityTypeRegistry.register(eventBus); } @@ -378,12 +381,12 @@ private void registerCapabilities(final RegisterCapabilitiesEvent event) { new RangedWrapper( wrapper, 0, - DiskInterfaceBlockEntity.AMOUNT_OF_DISKS / 2 + AbstractDiskInterfaceBlockEntity.AMOUNT_OF_DISKS / 2 ), new RangedWrapper( wrapper, - DiskInterfaceBlockEntity.AMOUNT_OF_DISKS / 2, - DiskInterfaceBlockEntity.AMOUNT_OF_DISKS + AbstractDiskInterfaceBlockEntity.AMOUNT_OF_DISKS / 2, + AbstractDiskInterfaceBlockEntity.AMOUNT_OF_DISKS ) ); } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java index 17bb5bff8..16314ba54 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java @@ -2,11 +2,11 @@ import com.refinedmods.refinedstorage2.platform.common.content.BlockColorMap; import com.refinedmods.refinedstorage2.platform.common.content.Blocks; -import com.refinedmods.refinedstorage2.platform.common.grid.AbstractGridBlock; import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.client.model.generators.BlockModelProvider; +import net.neoforged.neoforge.client.model.generators.CustomLoaderBuilder; import net.neoforged.neoforge.common.data.ExistingFileHelper; import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.MOD_ID; @@ -48,14 +48,15 @@ public BlockModelProviderImpl(final PackOutput output, final ExistingFileHelper protected void registerModels() { registerCables(); registerControllers(); - registerGrids(Blocks.INSTANCE.getGrid(), "grid"); - registerGrids(Blocks.INSTANCE.getCraftingGrid(), "crafting_grid"); + registerRightLeftBackFrontTopModel(Blocks.INSTANCE.getGrid(), "grid", ""); + registerRightLeftBackFrontTopModel(Blocks.INSTANCE.getCraftingGrid(), "crafting_grid", ""); registerDetectors(); registerWirelessTransmitters(); registerNetworkReceivers(); registerNetworkTransmitters(); registerSecurityManagers(); registerRelays(); + registerDiskInterfaces(); } private void registerCables() { @@ -84,19 +85,21 @@ private void registerControllers() { }); } - private void registerGrids(final BlockColorMap, ?> blockMap, final String name) { + private void registerRightLeftBackFrontTopModel(final BlockColorMap blockMap, + final String name, + final String modelPrefix) { blockMap.forEach((color, id, block) -> { final ResourceLocation cutout = createIdentifier(BLOCK_PREFIX + "/" + name + "/cutouts/" + color.getName()); - registerEmissiveGrids(name, color.getName(), cutout); + registerRightLeftBackFrontTopModel(name, modelPrefix + color.getName(), cutout, EMISSIVE_NORTH_CUTOUT); }); final ResourceLocation inactiveCutout = createIdentifier(BLOCK_PREFIX + "/" + name + "/cutouts/inactive"); - registerGrids(name, "inactive", inactiveCutout, NORTH_CUTOUT); + registerRightLeftBackFrontTopModel(name, "inactive", inactiveCutout, NORTH_CUTOUT); } - private void registerGrids(final String name, - final String variantName, - final ResourceLocation cutout, - final ResourceLocation baseModel) { + private void registerRightLeftBackFrontTopModel(final String name, + final String variantName, + final ResourceLocation cutout, + final ResourceLocation baseModel) { final ResourceLocation right = createIdentifier(BLOCK_PREFIX + "/" + name + "/right"); final ResourceLocation left = createIdentifier(BLOCK_PREFIX + "/" + name + "/left"); final ResourceLocation back = createIdentifier(BLOCK_PREFIX + "/" + name + "/back"); @@ -113,10 +116,6 @@ private void registerGrids(final String name, .texture(CUTOUT_TEXTURE, cutout); } - private void registerEmissiveGrids(final String name, final String variantName, final ResourceLocation cutout) { - registerGrids(name, variantName, cutout, EMISSIVE_NORTH_CUTOUT); - } - private void registerDetectors() { final ResourceLocation parent = createIdentifier("block/detector/powered"); final ResourceLocation side = createIdentifier("block/detector/side"); @@ -271,4 +270,17 @@ private void registerRelays() { .texture(CUTOUT_UP, cutoutIn) .texture(CUTOUT_DOWN, cutoutIn); } + + private void registerDiskInterfaces() { + registerRightLeftBackFrontTopModel(Blocks.INSTANCE.getDiskInterface(), "disk_interface", "base_"); + Blocks.INSTANCE.getDiskInterface() + .forEach((color, id, block) -> getBuilder("block/disk_interface/" + color.getName()) + .customLoader((blockModelBuilder, existingFileHelper) -> new CustomLoaderBuilder<>( + id, + blockModelBuilder, + existingFileHelper, + true + ) { + }).end()); + } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java index 659226ffb..4d6098d07 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java @@ -6,17 +6,14 @@ import com.refinedmods.refinedstorage2.platform.common.controller.AbstractControllerBlock; import com.refinedmods.refinedstorage2.platform.common.controller.ControllerEnergyType; import com.refinedmods.refinedstorage2.platform.common.detector.DetectorBlock; -import com.refinedmods.refinedstorage2.platform.common.grid.AbstractGridBlock; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkReceiverBlock; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterBlock; -import com.refinedmods.refinedstorage2.platform.common.networking.RelayBlock; import com.refinedmods.refinedstorage2.platform.common.support.AbstractActiveColoredDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.CableBlockSupport; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.HorizontalDirectionType; -import com.refinedmods.refinedstorage2.platform.common.wirelesstransmitter.WirelessTransmitterBlock; import java.util.EnumMap; import java.util.Map; @@ -73,6 +70,7 @@ protected void registerStatesAndModels() { registerNetworkTransmitters(); registerSecurityManagers(); registerRelays(); + registerDiskInterfaces(); } private void registerCables() { @@ -154,32 +152,18 @@ private static void addDirectionalRotation( } private void registerGrids() { - Blocks.INSTANCE.getGrid().forEach((color, id, block) -> configureGridVariants(color, block, "grid")); - Blocks.INSTANCE.getCraftingGrid().forEach((color, id, block) -> configureGridVariants( + Blocks.INSTANCE.getGrid().forEach((color, id, block) -> configureActiveColoredDirectionalBlock( + color, + block, + "grid" + )); + Blocks.INSTANCE.getCraftingGrid().forEach((color, id, block) -> configureActiveColoredDirectionalBlock( color, block, "crafting_grid" )); } - private void configureGridVariants(final DyeColor color, - final Supplier> block, - final String name) { - final ModelFile inactive = modelFile(createIdentifier(BLOCK_PREFIX + "/" + name + "/inactive")); - final ModelFile active = modelFile(createIdentifier(BLOCK_PREFIX + "/" + name + "/" + color.getName())); - final var builder = getVariantBuilder(block.get()); - builder.forAllStates(blockState -> { - final ConfiguredModel.Builder model = ConfiguredModel.builder(); - if (Boolean.TRUE.equals(blockState.getValue(AbstractGridBlock.ACTIVE))) { - model.modelFile(active); - } else { - model.modelFile(inactive); - } - addRotationFrontFacingNorth(model, blockState.getValue(BiDirectionType.INSTANCE.getProperty())); - return model.build(); - }); - } - private void registerControllers() { Blocks.INSTANCE.getController().forEach((color, id, block) -> configureControllerVariants(color, block)); Blocks.INSTANCE.getCreativeController().forEach( @@ -226,7 +210,7 @@ private void registerWirelessTransmitters() { final var builder = getVariantBuilder(block.get()); builder.forAllStates(blockState -> { final ConfiguredModel.Builder model = ConfiguredModel.builder(); - if (Boolean.TRUE.equals(blockState.getValue(WirelessTransmitterBlock.ACTIVE))) { + if (Boolean.TRUE.equals(blockState.getValue(AbstractActiveColoredDirectionalBlock.ACTIVE))) { model.modelFile(modelFile(createIdentifier("block/wireless_transmitter/" + color.getName()))); } else { model.modelFile(inactive); @@ -336,7 +320,7 @@ private void registerRelays() { final var builder = getVariantBuilder(block.get()); builder.forAllStates(blockState -> { final ConfiguredModel.Builder model = ConfiguredModel.builder(); - if (Boolean.TRUE.equals(blockState.getValue(RelayBlock.ACTIVE))) { + if (Boolean.TRUE.equals(blockState.getValue(AbstractActiveColoredDirectionalBlock.ACTIVE))) { model.modelFile(active); } else { model.modelFile(inactive); @@ -354,6 +338,36 @@ private void registerRelays() { }); } + private void registerDiskInterfaces() { + Blocks.INSTANCE.getDiskInterface().forEach((color, id, block) -> { + final var builder = getVariantBuilder(block.get()); + builder.addModels( + builder.partialState(), + ConfiguredModel.builder().modelFile( + modelFile(createIdentifier("block/disk_interface/" + color.getName())) + ).build() + ); + }); + } + + private void configureActiveColoredDirectionalBlock(final DyeColor color, + final Supplier block, + final String name) { + final ModelFile inactive = modelFile(createIdentifier(BLOCK_PREFIX + "/" + name + "/inactive")); + final ModelFile active = modelFile(createIdentifier(BLOCK_PREFIX + "/" + name + "/" + color.getName())); + final var builder = getVariantBuilder(block.get()); + builder.forAllStates(blockState -> { + final ConfiguredModel.Builder model = ConfiguredModel.builder(); + if (Boolean.TRUE.equals(blockState.getValue(AbstractActiveColoredDirectionalBlock.ACTIVE))) { + model.modelFile(active); + } else { + model.modelFile(inactive); + } + addRotationFrontFacingNorth(model, blockState.getValue(BiDirectionType.INSTANCE.getProperty())); + return model.build(); + }); + } + private void addRotation(final ConfiguredModel.Builder model, final Direction direction) { final int rotationX; if (direction.getAxis() == Direction.Axis.Y) { diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java index 9e48971b1..51f836178 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java @@ -15,6 +15,7 @@ import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; +import net.neoforged.neoforge.client.model.generators.CustomLoaderBuilder; import net.neoforged.neoforge.client.model.generators.ItemModelProvider; import net.neoforged.neoforge.client.model.generators.ModelFile; import net.neoforged.neoforge.common.data.ExistingFileHelper; @@ -48,6 +49,7 @@ protected void registerModels() { registerNetworkTransmitters(); registerSecurityManagers(); registerRelays(); + registerDiskInterfaces(); } private void registerCables() { @@ -195,6 +197,18 @@ private void registerRelays() { )); } + private void registerDiskInterfaces() { + final var blocks = Blocks.INSTANCE.getDiskInterface(); + blocks.forEach((color, id, block) -> getBuilder(id.getPath()).customLoader( + (blockModelBuilder, existingFileHelper) -> new CustomLoaderBuilder<>( + id, + blockModelBuilder, + existingFileHelper, + true + ) { + }).end()); + } + private ModelFile modelFile(final ResourceLocation location) { return new ModelFile.ExistingModelFile(location, existingFileHelper); } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/DiskContainerItemOverrides.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/DiskContainerItemOverrides.java new file mode 100644 index 000000000..f08602694 --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/DiskContainerItemOverrides.java @@ -0,0 +1,75 @@ +package com.refinedmods.refinedstorage2.platform.forge.storage; + +import com.refinedmods.refinedstorage2.api.storage.StorageState; +import com.refinedmods.refinedstorage2.platform.common.storage.AbstractDiskContainerBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.forge.support.render.ItemBakedModel; + +import java.util.List; +import java.util.Map; +import java.util.function.BiFunction; +import java.util.function.Function; +import javax.annotation.Nullable; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import org.joml.Vector3f; + +public class DiskContainerItemOverrides extends ItemOverrides { + private final LoadingCache cache; + private final BakedModel originalModel; + private final Vector3f[] diskTranslations; + private final Function cacheKeyFactory; + + public DiskContainerItemOverrides(final LoadingCache> blockCache, + final BakedModel originalModel, + final Vector3f[] diskTranslations, + final Function cacheKeyFactory, + final BiFunction cacheKeySideFactory) { + this.cache = CacheBuilder.newBuilder().build(CacheLoader.from(cacheKey -> new ItemBakedModel( + originalModel, + blockCache.getUnchecked(cacheKey), + Map.of( + Direction.NORTH, blockCache.getUnchecked(cacheKeySideFactory.apply(cacheKey, Direction.NORTH)), + Direction.EAST, blockCache.getUnchecked(cacheKeySideFactory.apply(cacheKey, Direction.EAST)), + Direction.SOUTH, blockCache.getUnchecked(cacheKeySideFactory.apply(cacheKey, Direction.SOUTH)), + Direction.WEST, blockCache.getUnchecked(cacheKeySideFactory.apply(cacheKey, Direction.WEST)), + Direction.UP, blockCache.getUnchecked(cacheKeySideFactory.apply(cacheKey, Direction.UP)), + Direction.DOWN, blockCache.getUnchecked(cacheKeySideFactory.apply(cacheKey, Direction.DOWN)) + ) + ))); + this.originalModel = originalModel; + this.diskTranslations = diskTranslations; + this.cacheKeyFactory = cacheKeyFactory; + } + + @Nullable + @Override + public BakedModel resolve(final BakedModel bakedModel, + final ItemStack stack, + @Nullable final ClientLevel level, + @Nullable final LivingEntity entity, + final int seed) { + final CompoundTag tag = BlockItem.getBlockEntityData(stack); + if (tag == null) { + return originalModel.getOverrides().resolve(bakedModel, stack, level, entity, seed); + } + final Disk[] disks = new Disk[diskTranslations.length]; + for (int i = 0; i < diskTranslations.length; ++i) { + final Item diskItem = AbstractDiskContainerBlockEntity.getDisk(tag, i); + disks[i] = new Disk(diskItem, diskItem == null ? StorageState.NONE : StorageState.INACTIVE); + } + return cache.getUnchecked(cacheKeyFactory.apply(disks)); + } +} diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java index 9b5f8e191..89fd3bb60 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java @@ -2,18 +2,16 @@ import com.refinedmods.refinedstorage2.api.storage.StorageState; import com.refinedmods.refinedstorage2.platform.common.storage.Disk; -import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; +import com.refinedmods.refinedstorage2.platform.forge.storage.DiskContainerItemOverrides; import com.refinedmods.refinedstorage2.platform.forge.support.render.DiskModelBaker; -import com.refinedmods.refinedstorage2.platform.forge.support.render.ItemBakedModel; import com.refinedmods.refinedstorage2.platform.forge.support.render.RotationTranslationModelBaker; import com.refinedmods.refinedstorage2.platform.forge.support.render.TransformationBuilder; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Objects; import javax.annotation.Nullable; @@ -21,18 +19,12 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.mojang.math.Transformation; -import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; import net.minecraft.util.RandomSource; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.client.model.BakedModelWrapper; import net.neoforged.neoforge.client.model.data.ModelData; @@ -40,7 +32,7 @@ class DiskDriveBakedModel extends BakedModelWrapper { private final LoadingCache> cache; - private final ItemOverrides itemOverrides = new DiskDriveItemOverrides(); + private final DiskContainerItemOverrides itemOverrides; private final Vector3f[] diskTranslations = new Vector3f[8]; DiskDriveBakedModel(final BakedModel baseModel, @@ -72,6 +64,13 @@ class DiskDriveBakedModel extends BakedModelWrapper { } return quads; })); + this.itemOverrides = new DiskContainerItemOverrides<>( + cache, + baseModel, + diskTranslations, + disks -> new CacheKey(null, true, BiDirection.NORTH, disks), + CacheKey::withSide + ); } @Override @@ -125,42 +124,6 @@ private static Vector3f getDiskTranslation(final int x, final int y) { ); } - private class DiskDriveItemOverrides extends ItemOverrides { - private final LoadingCache itemCache = CacheBuilder.newBuilder().build( - CacheLoader.from(cacheKey -> new ItemBakedModel( - originalModel, - cache.getUnchecked(cacheKey), - Map.of( - Direction.NORTH, cache.getUnchecked(cacheKey.withSide(Direction.NORTH)), - Direction.EAST, cache.getUnchecked(cacheKey.withSide(Direction.EAST)), - Direction.SOUTH, cache.getUnchecked(cacheKey.withSide(Direction.SOUTH)), - Direction.WEST, cache.getUnchecked(cacheKey.withSide(Direction.WEST)), - Direction.UP, cache.getUnchecked(cacheKey.withSide(Direction.UP)), - Direction.DOWN, cache.getUnchecked(cacheKey.withSide(Direction.DOWN)) - ) - )) - ); - - @Nullable - @Override - public BakedModel resolve(final BakedModel bakedModel, - final ItemStack stack, - @Nullable final ClientLevel level, - @Nullable final LivingEntity entity, - final int seed) { - final CompoundTag tag = BlockItem.getBlockEntityData(stack); - if (tag == null) { - return originalModel.getOverrides().resolve(bakedModel, stack, level, entity, seed); - } - final Disk[] disks = new Disk[8]; - for (int i = 0; i < diskTranslations.length; ++i) { - final Item diskItem = AbstractDiskDriveBlockEntity.getDisk(tag, i); - disks[i] = new Disk(diskItem, diskItem == null ? StorageState.NONE : StorageState.INACTIVE); - } - return itemCache.getUnchecked(new CacheKey(null, true, BiDirection.NORTH, disks)); - } - } - private record CacheKey(@Nullable Direction side, boolean withInactiveLed, BiDirection direction, Disk[] disks) { CacheKey withSide(final Direction newSide) { return new CacheKey(newSide, withInactiveLed, direction, disks); diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceBakedModel.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceBakedModel.java new file mode 100644 index 000000000..e8d124d39 --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceBakedModel.java @@ -0,0 +1,170 @@ +package com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface; + +import com.refinedmods.refinedstorage2.api.storage.StorageState; +import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.DiskInterfaceBlock; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractActiveColoredDirectionalBlock; +import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; +import com.refinedmods.refinedstorage2.platform.forge.storage.DiskContainerItemOverrides; +import com.refinedmods.refinedstorage2.platform.forge.support.render.DiskModelBaker; +import com.refinedmods.refinedstorage2.platform.forge.support.render.RotationTranslationModelBaker; +import com.refinedmods.refinedstorage2.platform.forge.support.render.TransformationBuilder; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nullable; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.mojang.math.Transformation; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.client.model.BakedModelWrapper; +import net.neoforged.neoforge.client.model.data.ModelData; +import org.joml.Vector3f; + +public class DiskInterfaceBakedModel extends BakedModelWrapper { + private final LoadingCache> cache; + private final DiskContainerItemOverrides itemOverrides; + private final Vector3f[] diskTranslations = new Vector3f[6]; + + DiskInterfaceBakedModel(final BakedModel baseModel, + final RotationTranslationModelBaker inactiveBaseModelBaker, + final RotationTranslationModelBaker baseModelBaker, + final DiskModelBaker diskModelBaker, + final RotationTranslationModelBaker ledInactiveModelBaker) { + super(baseModel); + for (int i = 0; i < 6; ++i) { + this.diskTranslations[i] = getDiskTranslation(i); + } + this.cache = CacheBuilder.newBuilder().build(CacheLoader.from(cacheKey -> { + final Transformation rotation = TransformationBuilder.create().rotate(cacheKey.direction).build(); + final RandomSource rand = RandomSource.create(); + final List quads = (cacheKey.active ? baseModelBaker : inactiveBaseModelBaker) + .bake(rotation, cacheKey.side, rand); + for (int j = 0; j < diskTranslations.length; ++j) { + final Disk disk = cacheKey.disks[j]; + quads.addAll(getDiskQuads(diskModelBaker, cacheKey, disk, j)); + if (cacheKey.withInactiveLed && disk.state() == StorageState.INACTIVE) { + final Transformation ledTransform = TransformationBuilder + .create() + .rotate(cacheKey.direction) + .translate(diskTranslations[j]) + .build(); + quads.addAll(ledInactiveModelBaker.bake(ledTransform, cacheKey.side, rand)); + } + } + return quads; + })); + this.itemOverrides = new DiskContainerItemOverrides<>( + cache, + baseModel, + diskTranslations, + disks -> new CacheKey(null, true, true, BiDirection.NORTH, disks), + CacheKey::withSide + ); + } + + @Override + public ItemOverrides getOverrides() { + return itemOverrides; + } + + @Override + public List getQuads(@Nullable final BlockState state, + @Nullable final Direction side, + final RandomSource rand, + final ModelData extraData, + @Nullable final RenderType renderType) { + if (state == null || !(state.getBlock() instanceof DiskInterfaceBlock diskInterfaceBlock)) { + return super.getQuads(state, side, rand); + } + final BiDirection direction = diskInterfaceBlock.getDirection(state); + if (direction == null) { + return super.getQuads(state, side, rand); + } + final Disk[] disks = extraData.get(ForgeDiskInterfaceBlockEntity.DISKS_PROPERTY); + if (disks == null) { + return super.getQuads(state, side, rand); + } + final boolean active = state.getValue(AbstractActiveColoredDirectionalBlock.ACTIVE); + return cache.getUnchecked(new CacheKey(side, active, false, direction, disks)); + } + + private List getDiskQuads(final DiskModelBaker diskBakers, + final CacheKey cacheKey, + final Disk disk, + final int index) { + if (disk.state() == StorageState.NONE || disk.item() == null) { + return Collections.emptyList(); + } + final RotationTranslationModelBaker diskBaker = diskBakers.forDisk(disk.item()); + if (diskBaker == null) { + return Collections.emptyList(); + } + final Transformation diskTransform = TransformationBuilder.create() + .rotate(cacheKey.direction) + .translate(diskTranslations[index]) + .build(); + return diskBaker.bake(diskTransform, cacheKey.side, RandomSource.create()); + } + + private static Vector3f getDiskTranslation(final int i) { + final int x = i < 3 ? 0 : 1; + final int y = i % 3; + return new Vector3f( + x == 0 ? -(2F / 16F) : -(9F / 16F), + -((y * 3F) / 16F) - (6F / 16F), + 0 + ); + } + + private record CacheKey(@Nullable Direction side, + boolean active, + boolean withInactiveLed, + BiDirection direction, + Disk[] disks) { + CacheKey withSide(final Direction newSide) { + return new CacheKey(newSide, active, withInactiveLed, direction, disks); + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final CacheKey cacheKey = (CacheKey) o; + return side == cacheKey.side && direction == cacheKey.direction && Arrays.equals(disks, cacheKey.disks) + && withInactiveLed == cacheKey.withInactiveLed && active == cacheKey.active; + } + + @Override + public int hashCode() { + int result = Objects.hash(side, active, direction, withInactiveLed); + result = 31 * result + Arrays.hashCode(disks); + return result; + } + + @Override + public String toString() { + return "CacheKey{" + + "side=" + side + + ", active=" + active + + ", withInactiveLed=" + withInactiveLed + + ", direction=" + direction + + ", disks=" + Arrays.toString(disks) + + '}'; + } + } +} diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceBlockEntityRendererImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceBlockEntityRendererImpl.java new file mode 100644 index 000000000..0e13258da --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceBlockEntityRendererImpl.java @@ -0,0 +1,18 @@ +package com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntityRenderer; +import com.refinedmods.refinedstorage2.platform.forge.support.render.RenderTypes; + +public class DiskInterfaceBlockEntityRendererImpl + extends AbstractDiskInterfaceBlockEntityRenderer { + public DiskInterfaceBlockEntityRendererImpl() { + super(RenderTypes.DISK_LED); + } + + @Override + protected Disk[] getDisks(final AbstractDiskInterfaceBlockEntity blockEntity) { + return blockEntity.getModelData().get(ForgeDiskInterfaceBlockEntity.DISKS_PROPERTY); + } +} diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceGeometryLoader.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceGeometryLoader.java new file mode 100644 index 000000000..a1654762a --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceGeometryLoader.java @@ -0,0 +1,20 @@ +package com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import net.minecraft.world.item.DyeColor; +import net.neoforged.neoforge.client.model.geometry.IGeometryLoader; + +public class DiskInterfaceGeometryLoader implements IGeometryLoader { + private final DyeColor color; + + public DiskInterfaceGeometryLoader(final DyeColor color) { + this.color = color; + } + + @Override + public DiskInterfaceUnbakedGeometry read(final JsonObject jsonObject, + final JsonDeserializationContext deserializationContext) { + return new DiskInterfaceUnbakedGeometry(color); + } +} diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceUnbakedGeometry.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceUnbakedGeometry.java new file mode 100644 index 000000000..8e5065ed3 --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/DiskInterfaceUnbakedGeometry.java @@ -0,0 +1,60 @@ +package com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.forge.support.render.DiskModelBaker; +import com.refinedmods.refinedstorage2.platform.forge.support.render.RotationTranslationModelBaker; + +import java.util.function.Function; + +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.Material; +import net.minecraft.client.resources.model.ModelBaker; +import net.minecraft.client.resources.model.ModelState; +import net.minecraft.client.resources.model.UnbakedModel; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; +import net.neoforged.neoforge.client.model.geometry.IGeometryBakingContext; +import net.neoforged.neoforge.client.model.geometry.IUnbakedGeometry; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; +import static java.util.Objects.requireNonNull; + +public class DiskInterfaceUnbakedGeometry implements IUnbakedGeometry { + private static final ResourceLocation INACTIVE_MODEL = createIdentifier("block/disk_interface/inactive"); + private static final ResourceLocation LED_INACTIVE_MODEL = createIdentifier("block/disk/led_inactive"); + + private final ResourceLocation baseModel; + + DiskInterfaceUnbakedGeometry(final DyeColor color) { + this.baseModel = createIdentifier("block/disk_interface/base_" + color.getName()); + } + + @Override + public void resolveParents(final Function modelGetter, + final IGeometryBakingContext context) { + modelGetter.apply(baseModel).resolveParents(modelGetter); + modelGetter.apply(INACTIVE_MODEL).resolveParents(modelGetter); + PlatformApi.INSTANCE.getStorageContainerItemHelper().getDiskModels().forEach( + diskModel -> modelGetter.apply(diskModel).resolveParents(modelGetter) + ); + modelGetter.apply(LED_INACTIVE_MODEL).resolveParents(modelGetter); + } + + @Override + public BakedModel bake(final IGeometryBakingContext context, + final ModelBaker baker, + final Function spriteGetter, + final ModelState modelState, + final ItemOverrides overrides, + final ResourceLocation modelLocation) { + return new DiskInterfaceBakedModel( + requireNonNull(baker.bake(baseModel, modelState, spriteGetter)), + new RotationTranslationModelBaker(modelState, baker, spriteGetter, INACTIVE_MODEL), + new RotationTranslationModelBaker(modelState, baker, spriteGetter, baseModel), + new DiskModelBaker(modelState, baker, spriteGetter), + new RotationTranslationModelBaker(modelState, baker, spriteGetter, LED_INACTIVE_MODEL) + ); + } +} diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/ForgeDiskInterfaceBlockEntity.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/ForgeDiskInterfaceBlockEntity.java new file mode 100644 index 000000000..d163d6605 --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/ForgeDiskInterfaceBlockEntity.java @@ -0,0 +1,31 @@ +package com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface; + +import com.refinedmods.refinedstorage2.platform.common.storage.Disk; +import com.refinedmods.refinedstorage2.platform.common.storage.diskinterface.AbstractDiskInterfaceBlockEntity; + +import javax.annotation.Nonnull; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.client.model.data.ModelData; +import net.neoforged.neoforge.client.model.data.ModelProperty; + +public class ForgeDiskInterfaceBlockEntity extends AbstractDiskInterfaceBlockEntity { + public static final ModelProperty DISKS_PROPERTY = new ModelProperty<>(); + + public ForgeDiskInterfaceBlockEntity(final BlockPos pos, final BlockState state) { + super(pos, state); + } + + @Override + protected void onClientDriveStateUpdated() { + requestModelDataUpdate(); + super.onClientDriveStateUpdated(); + } + + @Nonnull + @Override + public ModelData getModelData() { + return ModelData.builder().with(DISKS_PROPERTY, disks).build(); + } +} diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/package-info.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/package-info.java new file mode 100644 index 000000000..8ab276a04 --- /dev/null +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskinterface/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage2.platform.forge.storage.diskinterface; + +import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault;