mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-25 16:38:33 +01:00
Compare commits
5 commits
ecada0d3d9
...
758001e2fd
Author | SHA1 | Date | |
---|---|---|---|
|
758001e2fd | ||
|
b5cb343492 | ||
|
276c2dbd95 | ||
|
c952c779a4 | ||
|
9d166ac988 |
76 changed files with 1095 additions and 484 deletions
|
@ -80,6 +80,7 @@ repositories {
|
||||||
includeGroup "curse.maven"
|
includeGroup "curse.maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
maven { url = 'https://maven.octo-studios.com/releases' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -97,6 +98,8 @@ dependencies {
|
||||||
|
|
||||||
localRuntime "curse.maven:jade-324717:5803666"
|
localRuntime "curse.maven:jade-324717:5803666"
|
||||||
localRuntime "curse.maven:mekanism-268560:5680395"
|
localRuntime "curse.maven:mekanism-268560:5680395"
|
||||||
|
|
||||||
|
implementation "top.theillusivec4.curios:curios-neoforge:${curios_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|
|
@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
# Actually Additions
|
# Actually Additions
|
||||||
|
|
||||||
mod_version=1.3.4
|
mod_version=1.3.5
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
game_version=1.21.1
|
game_version=1.21.1
|
||||||
|
@ -18,3 +18,4 @@ jei_minecraft=1.21.1
|
||||||
jei_version=19.21.0.246
|
jei_version=19.21.0.246
|
||||||
patchouli_version=1.21-87-NEOFORGE
|
patchouli_version=1.21-87-NEOFORGE
|
||||||
patchouli_provider_version=1.21.1-1.0.11-Snapshot.3
|
patchouli_provider_version=1.21.1-1.0.11-Snapshot.3
|
||||||
|
curios_version=9.+
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
// 1.21.1 2024-08-11T19:30:01.8288198 Block Tags
|
// 1.21.1 2024-10-19T16:19:48.5749712 Block Tags
|
||||||
8665de82dd3d3a1351ce58f78108214f359104b0 data/actuallyadditions/tags/block/mineable/aio.json
|
8665de82dd3d3a1351ce58f78108214f359104b0 data/actuallyadditions/tags/block/mineable/aio.json
|
||||||
f7dc293929a2176bc6e428c765f6bf49fbeccdb5 data/actuallyadditions/tags/block/mineable/drill.json
|
f7dc293929a2176bc6e428c765f6bf49fbeccdb5 data/actuallyadditions/tags/block/mineable/drill.json
|
||||||
3ce233e27b4d7db10e2d4832602ef5b2a57f9a65 data/c/tags/block/ores.json
|
3ce233e27b4d7db10e2d4832602ef5b2a57f9a65 data/c/tags/block/ores.json
|
||||||
2bcfae7c119b0b64170989e7d41b352a8d55ea43 data/c/tags/block/ores/black_quartz.json
|
2bcfae7c119b0b64170989e7d41b352a8d55ea43 data/c/tags/block/ores/black_quartz.json
|
||||||
2bcfae7c119b0b64170989e7d41b352a8d55ea43 data/c/tags/block/ores_in_ground/stone.json
|
2bcfae7c119b0b64170989e7d41b352a8d55ea43 data/c/tags/block/ores_in_ground/stone.json
|
||||||
6c9a3c952d8fad5bfd8a5ab0b76aeb0b930d1db9 data/c/tags/block/storage_blocks/black_quartz.json
|
6c9a3c952d8fad5bfd8a5ab0b76aeb0b930d1db9 data/c/tags/block/storage_blocks/black_quartz.json
|
||||||
|
02a18fabd2fe852ec9d6564242eaef8b58dd6517 data/c/tags/block/storage_blocks/diamatine_crystal.json
|
||||||
|
e38d81e8b3eef1f8a225b98891672f00942496e9 data/c/tags/block/storage_blocks/emeradic_crystal.json
|
||||||
|
bbce87d7a828d3e31abf1209cceb3c6084423678 data/c/tags/block/storage_blocks/empowered_diamatine_crystal.json
|
||||||
|
520350a8e9e7818642cc7d663396a1d3c238d9ec data/c/tags/block/storage_blocks/empowered_emeradic_crystal.json
|
||||||
|
9ad94fbd4cda9e4ad8c68078cc53b67eb4043160 data/c/tags/block/storage_blocks/empowered_enori_crystal.json
|
||||||
|
fb95ac8041521e1d2879f6fcb652266dcd9e0fb1 data/c/tags/block/storage_blocks/empowered_palis_crystal.json
|
||||||
|
4885ac9140dbf4f8af14cf61e6ec9e81b933b77b data/c/tags/block/storage_blocks/empowered_restonia_crystal.json
|
||||||
|
5a912b868ae8a193bc17f5c3f485e22818c3c06f data/c/tags/block/storage_blocks/empowered_void_crystal.json
|
||||||
|
741733f39fa70fc6a7a85f033088821af14971c6 data/c/tags/block/storage_blocks/enori_crystal.json
|
||||||
|
148cd937543fd58b196403c18839b2698bf87fdf data/c/tags/block/storage_blocks/palis_crystal.json
|
||||||
|
b9aa28a54d47054ba5653bec2f20e0a675ab5120 data/c/tags/block/storage_blocks/restonia_crystal.json
|
||||||
|
fb4f349bc6fd89f26ef2ba72a9236f05eefd8ea2 data/c/tags/block/storage_blocks/void_crystal.json
|
||||||
8dbaf9b7bd6774bc7c01a47a72b8a7fdaee51f87 data/minecraft/tags/block/mineable/axe.json
|
8dbaf9b7bd6774bc7c01a47a72b8a7fdaee51f87 data/minecraft/tags/block/mineable/axe.json
|
||||||
58c611cbaae2a0a5dd6f82f183b7d0f5dc2d09e6 data/minecraft/tags/block/mineable/pickaxe.json
|
58c611cbaae2a0a5dd6f82f183b7d0f5dc2d09e6 data/minecraft/tags/block/mineable/pickaxe.json
|
||||||
fab721a4fe7ece1d0e019ce36c4d2862f70ee53b data/minecraft/tags/block/needs_stone_tool.json
|
fab721a4fe7ece1d0e019ce36c4d2862f70ee53b data/minecraft/tags/block/needs_stone_tool.json
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
// 1.21.1 2024-08-11T19:30:01.8138177 Tags for minecraft:item mod id actuallyadditions
|
// 1.21.1 2024-10-19T11:22:45.676221 Tags for minecraft:item mod id actuallyadditions
|
||||||
87327118c2f16da245b76de4fdcaab149456d9b8 data/actuallyadditions/tags/item/coffee_beans.json
|
87327118c2f16da245b76de4fdcaab149456d9b8 data/actuallyadditions/tags/item/coffee_beans.json
|
||||||
f3ee78cd8c9563bd1828de2b4b336735f289f9f2 data/actuallyadditions/tags/item/crystals.json
|
f3ee78cd8c9563bd1828de2b4b336735f289f9f2 data/actuallyadditions/tags/item/crystals.json
|
||||||
441008b49b4bab00125100fc969cb6582eff7271 data/actuallyadditions/tags/item/crystal_blocks.json
|
441008b49b4bab00125100fc969cb6582eff7271 data/actuallyadditions/tags/item/crystal_blocks.json
|
||||||
7e6e49c3eb5302af147a2d6ba439e83bd4831cbc data/actuallyadditions/tags/item/drills.json
|
7e6e49c3eb5302af147a2d6ba439e83bd4831cbc data/actuallyadditions/tags/item/drills.json
|
||||||
ae55da193b94fd6375c05d5aa46cafdda9d335cd data/actuallyadditions/tags/item/tiny_coals.json
|
ae55da193b94fd6375c05d5aa46cafdda9d335cd data/actuallyadditions/tags/item/tiny_coals.json
|
||||||
|
d0115caba2ef0aae6d1c07068d2b30819dfad612 data/curios/tags/item/charm.json
|
||||||
|
dc377437805c7c5696b88c17454da7b856b9055e data/c/tags/item/buckets.json
|
||||||
|
ea53bfe045e7e533a13fa2fa8793cd7741e92902 data/c/tags/item/bucket/canola_oil.json
|
||||||
|
fb46ac4e564c749fcaa5ba1393ab33fcd91817f5 data/c/tags/item/bucket/crystallized_oil.json
|
||||||
|
e70a00f63e5f22e8f37d76d45bbadc66ff0e3598 data/c/tags/item/bucket/empowered_oil.json
|
||||||
|
3d76a9a33b8db313d2960468ef55ae7baf1d997f data/c/tags/item/bucket/refined_canola_oil.json
|
||||||
822a882fc0d985d819c32a1039616f999761fae3 data/c/tags/item/crops.json
|
822a882fc0d985d819c32a1039616f999761fae3 data/c/tags/item/crops.json
|
||||||
aaf3c8c818cc015e9c693e0bbf8f86da81f78285 data/c/tags/item/crops/canola.json
|
aaf3c8c818cc015e9c693e0bbf8f86da81f78285 data/c/tags/item/crops/canola.json
|
||||||
87327118c2f16da245b76de4fdcaab149456d9b8 data/c/tags/item/crops/coffee.json
|
87327118c2f16da245b76de4fdcaab149456d9b8 data/c/tags/item/crops/coffee.json
|
||||||
|
@ -18,5 +24,17 @@ f29e7ca84f30d7b2d4b19ad10b62f56fc422378a data/c/tags/item/seeds/canola.json
|
||||||
87327118c2f16da245b76de4fdcaab149456d9b8 data/c/tags/item/seeds/coffee.json
|
87327118c2f16da245b76de4fdcaab149456d9b8 data/c/tags/item/seeds/coffee.json
|
||||||
4be6e9ebd0f4ea040587e7ff05c78270990889b8 data/c/tags/item/seeds/flax.json
|
4be6e9ebd0f4ea040587e7ff05c78270990889b8 data/c/tags/item/seeds/flax.json
|
||||||
27f7953be7073bc266bdf5a245658268d11a4252 data/c/tags/item/seeds/rice.json
|
27f7953be7073bc266bdf5a245658268d11a4252 data/c/tags/item/seeds/rice.json
|
||||||
da125442e98e78f6dac7e0c8f35a51503f5bb79d data/c/tags/item/slimeballs.json
|
da125442e98e78f6dac7e0c8f35a51503f5bb79d data/c/tags/item/slime_balls.json
|
||||||
6c9a3c952d8fad5bfd8a5ab0b76aeb0b930d1db9 data/c/tags/item/storage_blocks/black_quartz.json
|
6c9a3c952d8fad5bfd8a5ab0b76aeb0b930d1db9 data/c/tags/item/storage_blocks/black_quartz.json
|
||||||
|
02a18fabd2fe852ec9d6564242eaef8b58dd6517 data/c/tags/item/storage_blocks/diamatine_crystal.json
|
||||||
|
e38d81e8b3eef1f8a225b98891672f00942496e9 data/c/tags/item/storage_blocks/emeradic_crystal.json
|
||||||
|
bbce87d7a828d3e31abf1209cceb3c6084423678 data/c/tags/item/storage_blocks/empowered_diamatine_crystal.json
|
||||||
|
520350a8e9e7818642cc7d663396a1d3c238d9ec data/c/tags/item/storage_blocks/empowered_emeradic_crystal.json
|
||||||
|
9ad94fbd4cda9e4ad8c68078cc53b67eb4043160 data/c/tags/item/storage_blocks/empowered_enori_crystal.json
|
||||||
|
fb95ac8041521e1d2879f6fcb652266dcd9e0fb1 data/c/tags/item/storage_blocks/empowered_palis_crystal.json
|
||||||
|
4885ac9140dbf4f8af14cf61e6ec9e81b933b77b data/c/tags/item/storage_blocks/empowered_restonia_crystal.json
|
||||||
|
5a912b868ae8a193bc17f5c3f485e22818c3c06f data/c/tags/item/storage_blocks/empowered_void_crystal.json
|
||||||
|
741733f39fa70fc6a7a85f033088821af14971c6 data/c/tags/item/storage_blocks/enori_crystal.json
|
||||||
|
148cd937543fd58b196403c18839b2698bf87fdf data/c/tags/item/storage_blocks/palis_crystal.json
|
||||||
|
b9aa28a54d47054ba5653bec2f20e0a675ab5120 data/c/tags/item/storage_blocks/restonia_crystal.json
|
||||||
|
fb4f349bc6fd89f26ef2ba72a9236f05eefd8ea2 data/c/tags/item/storage_blocks/void_crystal.json
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// 1.21.1 2024-10-19T11:22:45.6782191 Curios for actuallyadditions
|
||||||
|
42b9baaa8afba52b9f39f6830fc7620e3eb75c70 data/actuallyadditions/curios/entities/player.json
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"entities": [
|
||||||
|
"minecraft:player"
|
||||||
|
],
|
||||||
|
"slots": [
|
||||||
|
"charm"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:diamatine_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:emeradic_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_diamatine_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_emeradic_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_enori_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_palis_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_restonia_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_void_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:enori_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:palis_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:restonia_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:void_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:canola_oil_bucket"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:crystallized_oil_bucket"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_oil_bucket"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:refined_canola_oil_bucket"
|
||||||
|
]
|
||||||
|
}
|
8
src/generated/resources/data/c/tags/item/buckets.json
Normal file
8
src/generated/resources/data/c/tags/item/buckets.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"#c:bucket/canola_oil",
|
||||||
|
"#c:bucket/refined_canola_oil",
|
||||||
|
"#c:bucket/crystallized_oil",
|
||||||
|
"#c:bucket/empowered_oil"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:diamatine_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:emeradic_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_diamatine_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_emeradic_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_enori_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_palis_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_restonia_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:empowered_void_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:enori_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:palis_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:restonia_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:void_crystal_block"
|
||||||
|
]
|
||||||
|
}
|
5
src/generated/resources/data/curios/tags/item/charm.json
Normal file
5
src/generated/resources/data/curios/tags/item/charm.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"values": [
|
||||||
|
"actuallyadditions:crafter_on_a_stick"
|
||||||
|
]
|
||||||
|
}
|
|
@ -38,6 +38,26 @@ public final class ActuallyTags {
|
||||||
public static final TagKey<Item> GEMS_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "gems/black_quartz"));
|
public static final TagKey<Item> GEMS_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "gems/black_quartz"));
|
||||||
public static final TagKey<Item> ORES_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "ores/black_quartz"));
|
public static final TagKey<Item> ORES_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "ores/black_quartz"));
|
||||||
public static final TagKey<Item> STORAGE_BLOCKS_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/black_quartz"));
|
public static final TagKey<Item> STORAGE_BLOCKS_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/black_quartz"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_RESTONIA_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/restonia_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_PALIS_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/palis_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_DIAMATINE_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/diamatine_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_VOID_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/void_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMERADIC_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/emeradic_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_ENORI_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/enori_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMPOWERED_RESTONIA_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_restonia_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMPOWERED_PALIS_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_palis_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMPOWERED_DIAMATINE_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_diamatine_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMPOWERED_VOID_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_void_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMPOWERED_EMERADIC_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_emeradic_crystal"));
|
||||||
|
public static final TagKey<Item> STORAGE_BLOCKS_EMPOWERED_ENORI_CRYSTAL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_enori_crystal"));
|
||||||
|
public static final TagKey<Item> BUCKET_CANOLA_OIL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "bucket/canola_oil"));
|
||||||
|
public static final TagKey<Item> BUCKET_REFINED_CANOLA_OIL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "bucket/refined_canola_oil"));
|
||||||
|
public static final TagKey<Item> BUCKET_CRYSTALLIZED_OIL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "bucket/crystallized_oil"));
|
||||||
|
public static final TagKey<Item> BUCKET_EMPOWERED_OIL = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "bucket/empowered_oil"));
|
||||||
|
|
||||||
|
//curios:bracelet
|
||||||
|
public static final TagKey<Item> CURIOS_CHARM = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("curios", "charm"));
|
||||||
|
|
||||||
|
|
||||||
private static TagKey<Item> tag(String name) {
|
private static TagKey<Item> tag(String name) {
|
||||||
return TagKey.create(Registries.ITEM, ActuallyAdditions.modLoc(name));
|
return TagKey.create(Registries.ITEM, ActuallyAdditions.modLoc(name));
|
||||||
|
@ -60,7 +80,18 @@ public final class ActuallyTags {
|
||||||
public static final TagKey<Block> NEEDS_ENORI_TOOL = tag("needs_enori_tool");
|
public static final TagKey<Block> NEEDS_ENORI_TOOL = tag("needs_enori_tool");
|
||||||
public static final TagKey<Block> ORES_BLACK_QUARTZ = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "ores/black_quartz"));
|
public static final TagKey<Block> ORES_BLACK_QUARTZ = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "ores/black_quartz"));
|
||||||
public static final TagKey<Block> STORAGE_BLOCKS_BLACK_QUARTZ = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/black_quartz"));
|
public static final TagKey<Block> STORAGE_BLOCKS_BLACK_QUARTZ = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/black_quartz"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_RESTONIA_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/restonia_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_PALIS_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/palis_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_DIAMATINE_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/diamatine_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_VOID_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/void_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMERADIC_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/emeradic_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_ENORI_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/enori_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMPOWERED_RESTONIA_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_restonia_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMPOWERED_PALIS_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_palis_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMPOWERED_DIAMATINE_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_diamatine_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMPOWERED_VOID_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_void_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMPOWERED_EMERADIC_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_emeradic_crystal"));
|
||||||
|
public static final TagKey<Block> STORAGE_BLOCKS_EMPOWERED_ENORI_CRYSTAL = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/empowered_enori_crystal"));
|
||||||
|
|
||||||
private static TagKey<Block> tag(String name) {
|
private static TagKey<Block> tag(String name) {
|
||||||
return TagKey.create(Registries.BLOCK, ActuallyAdditions.modLoc(name));
|
return TagKey.create(Registries.BLOCK, ActuallyAdditions.modLoc(name));
|
||||||
|
|
|
@ -72,6 +72,8 @@ public class ActuallyAdditionsData {
|
||||||
|
|
||||||
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
|
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
|
||||||
packOutput, patchedProvider, Set.of(ActuallyAdditions.MODID)));
|
packOutput, patchedProvider, Set.of(ActuallyAdditions.MODID)));
|
||||||
|
|
||||||
|
generator.addProvider(true, new Curios(packOutput, helper, lookupProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RegistrySetBuilder.PatchedRegistries getProvider() {
|
private static RegistrySetBuilder.PatchedRegistries getProvider() {
|
||||||
|
|
|
@ -167,6 +167,18 @@ public class BlockTagsGenerator extends BlockTagsProvider {
|
||||||
this.tag(Tags.Blocks.ORES).addTags(ActuallyTags.Blocks.ORES_BLACK_QUARTZ);
|
this.tag(Tags.Blocks.ORES).addTags(ActuallyTags.Blocks.ORES_BLACK_QUARTZ);
|
||||||
this.tag(Tags.Blocks.ORES_IN_GROUND_STONE).add(ActuallyBlocks.BLACK_QUARTZ_ORE.get());
|
this.tag(Tags.Blocks.ORES_IN_GROUND_STONE).add(ActuallyBlocks.BLACK_QUARTZ_ORE.get());
|
||||||
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_BLACK_QUARTZ).add(ActuallyBlocks.BLACK_QUARTZ.get());
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_BLACK_QUARTZ).add(ActuallyBlocks.BLACK_QUARTZ.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_RESTONIA_CRYSTAL).add(ActuallyBlocks.RESTONIA_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_PALIS_CRYSTAL).add(ActuallyBlocks.PALIS_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_DIAMATINE_CRYSTAL).add(ActuallyBlocks.DIAMATINE_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_VOID_CRYSTAL).add(ActuallyBlocks.VOID_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMERADIC_CRYSTAL).add(ActuallyBlocks.EMERADIC_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_ENORI_CRYSTAL).add(ActuallyBlocks.ENORI_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMPOWERED_RESTONIA_CRYSTAL).add(ActuallyBlocks.EMPOWERED_RESTONIA_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMPOWERED_PALIS_CRYSTAL).add(ActuallyBlocks.EMPOWERED_PALIS_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMPOWERED_DIAMATINE_CRYSTAL).add(ActuallyBlocks.EMPOWERED_DIAMATINE_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMPOWERED_VOID_CRYSTAL).add(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMPOWERED_EMERADIC_CRYSTAL).add(ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL.get());
|
||||||
|
this.tag(ActuallyTags.Blocks.STORAGE_BLOCKS_EMPOWERED_ENORI_CRYSTAL).add(ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
21
src/main/java/de/ellpeck/actuallyadditions/data/Curios.java
Normal file
21
src/main/java/de/ellpeck/actuallyadditions/data/Curios.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.data.PackOutput;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
|
import top.theillusivec4.curios.api.CuriosDataProvider;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class Curios extends CuriosDataProvider {
|
||||||
|
public Curios(PackOutput output, ExistingFileHelper fileHelper, CompletableFuture<HolderLookup.Provider> registries) {
|
||||||
|
super(ActuallyAdditions.MODID, output, fileHelper, registries);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generate(HolderLookup.Provider registries, ExistingFileHelper fileHelper) {
|
||||||
|
createEntities("player").addEntities(EntityType.PLAYER).addSlots("charm");
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package de.ellpeck.actuallyadditions.data;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
|
@ -44,7 +45,7 @@ public class ItemTagsGenerator extends ItemTagsProvider {
|
||||||
ActuallyBlocks.DIAMATINE_CRYSTAL.getItem(), ActuallyBlocks.VOID_CRYSTAL.getItem(),
|
ActuallyBlocks.DIAMATINE_CRYSTAL.getItem(), ActuallyBlocks.VOID_CRYSTAL.getItem(),
|
||||||
ActuallyBlocks.EMERADIC_CRYSTAL.getItem(), ActuallyBlocks.ENORI_CRYSTAL.getItem());
|
ActuallyBlocks.EMERADIC_CRYSTAL.getItem(), ActuallyBlocks.ENORI_CRYSTAL.getItem());
|
||||||
|
|
||||||
tag(Tags.Items.SLIMEBALLS)
|
tag(Tags.Items.SLIME_BALLS)
|
||||||
.add(ActuallyItems.RICE_SLIMEBALL.get());
|
.add(ActuallyItems.RICE_SLIMEBALL.get());
|
||||||
|
|
||||||
tag(ActuallyTags.Items.CROPS_RICE).add(ActuallyItems.RICE.get());
|
tag(ActuallyTags.Items.CROPS_RICE).add(ActuallyItems.RICE.get());
|
||||||
|
@ -63,6 +64,30 @@ public class ItemTagsGenerator extends ItemTagsProvider {
|
||||||
tag(ActuallyTags.Items.ORES_BLACK_QUARTZ).add(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem());
|
tag(ActuallyTags.Items.ORES_BLACK_QUARTZ).add(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem());
|
||||||
tag(Tags.Items.ORES).addTags(ActuallyTags.Items.ORES_BLACK_QUARTZ);
|
tag(Tags.Items.ORES).addTags(ActuallyTags.Items.ORES_BLACK_QUARTZ);
|
||||||
tag(Tags.Items.ORES_IN_GROUND_STONE).add(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem());
|
tag(Tags.Items.ORES_IN_GROUND_STONE).add(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem());
|
||||||
|
|
||||||
tag(ActuallyTags.Items.STORAGE_BLOCKS_BLACK_QUARTZ).add(ActuallyBlocks.BLACK_QUARTZ.getItem());
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_BLACK_QUARTZ).add(ActuallyBlocks.BLACK_QUARTZ.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_RESTONIA_CRYSTAL).add(ActuallyBlocks.RESTONIA_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_PALIS_CRYSTAL).add(ActuallyBlocks.PALIS_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_DIAMATINE_CRYSTAL).add(ActuallyBlocks.DIAMATINE_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_VOID_CRYSTAL).add(ActuallyBlocks.VOID_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMERADIC_CRYSTAL).add(ActuallyBlocks.EMERADIC_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_ENORI_CRYSTAL).add(ActuallyBlocks.ENORI_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMPOWERED_RESTONIA_CRYSTAL).add(ActuallyBlocks.EMPOWERED_RESTONIA_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMPOWERED_PALIS_CRYSTAL).add(ActuallyBlocks.EMPOWERED_PALIS_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMPOWERED_DIAMATINE_CRYSTAL).add(ActuallyBlocks.EMPOWERED_DIAMATINE_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMPOWERED_VOID_CRYSTAL).add(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMPOWERED_EMERADIC_CRYSTAL).add(ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL.getItem());
|
||||||
|
tag(ActuallyTags.Items.STORAGE_BLOCKS_EMPOWERED_ENORI_CRYSTAL).add(ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL.getItem());
|
||||||
|
|
||||||
|
tag(ActuallyTags.Items.BUCKET_CANOLA_OIL).add(InitFluids.CANOLA_OIL.getBucket());
|
||||||
|
tag(ActuallyTags.Items.BUCKET_REFINED_CANOLA_OIL).add(InitFluids.REFINED_CANOLA_OIL.getBucket());
|
||||||
|
tag(ActuallyTags.Items.BUCKET_CRYSTALLIZED_OIL).add(InitFluids.CRYSTALLIZED_OIL.getBucket());
|
||||||
|
tag(ActuallyTags.Items.BUCKET_EMPOWERED_OIL).add(InitFluids.EMPOWERED_OIL.getBucket());
|
||||||
|
tag(Tags.Items.BUCKETS).addTags(
|
||||||
|
ActuallyTags.Items.BUCKET_CANOLA_OIL, ActuallyTags.Items.BUCKET_REFINED_CANOLA_OIL,
|
||||||
|
ActuallyTags.Items.BUCKET_CRYSTALLIZED_OIL, ActuallyTags.Items.BUCKET_EMPOWERED_OIL
|
||||||
|
);
|
||||||
|
|
||||||
|
tag(ActuallyTags.Items.CURIOS_CHARM).add(ActuallyItems.CRAFTER_ON_A_STICK.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
@ -43,6 +44,7 @@ import net.minecraft.world.item.Items;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.fml.ModContainer;
|
import net.neoforged.fml.ModContainer;
|
||||||
|
import net.neoforged.fml.ModList;
|
||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.fml.config.ModConfig;
|
import net.neoforged.fml.config.ModConfig;
|
||||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||||
|
@ -107,6 +109,7 @@ public class ActuallyAdditions {
|
||||||
eventBus.addListener(this::setup);
|
eventBus.addListener(this::setup);
|
||||||
|
|
||||||
if (dist.isClient()) {
|
if (dist.isClient()) {
|
||||||
|
ActuallyAdditionsClient.init(eventBus);
|
||||||
container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
|
container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
|
||||||
eventBus.addListener(ActuallyAdditionsClient::setup);
|
eventBus.addListener(ActuallyAdditionsClient::setup);
|
||||||
eventBus.addListener(ActuallyAdditionsClient::setupMenus);
|
eventBus.addListener(ActuallyAdditionsClient::setupMenus);
|
||||||
|
@ -114,6 +117,8 @@ public class ActuallyAdditions {
|
||||||
eventBus.addListener(ActuallyAdditionsClient::registerParticleFactories);
|
eventBus.addListener(ActuallyAdditionsClient::registerParticleFactories);
|
||||||
}
|
}
|
||||||
IFarmerBehavior.initBehaviors();
|
IFarmerBehavior.initBehaviors();
|
||||||
|
|
||||||
|
Util.curiosLoaded = ModList.get().isLoaded("curios");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void reloadEvent(AddReloadListenerEvent event) {
|
private static void reloadEvent(AddReloadListenerEvent event) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.ReconstructorRenderer;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.ReconstructorRenderer;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox;
|
||||||
|
@ -50,10 +51,12 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.SackGui;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.VoidSackGui;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.VoidSackGui;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.HotkeyPacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem;
|
import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.patchouli.PatchouliPages;
|
import de.ellpeck.actuallyadditions.mod.patchouli.PatchouliPages;
|
||||||
|
import net.minecraft.client.KeyMapping;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||||
|
@ -62,14 +65,24 @@ import net.minecraft.client.renderer.item.ItemProperties;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
|
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.fml.ModList;
|
import net.neoforged.fml.ModList;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
import net.neoforged.neoforge.client.event.*;
|
||||||
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
|
import net.neoforged.neoforge.client.settings.KeyConflictContext;
|
||||||
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
|
|
||||||
import net.neoforged.neoforge.common.NeoForge;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class ActuallyAdditionsClient {
|
public class ActuallyAdditionsClient {
|
||||||
|
private static final KeyMapping OPEN_CRAFTING_KEY = new KeyMapping("key.actualladditions.crafting_stick_open.desc", KeyConflictContext.IN_GAME, InputConstants.Type.KEYSYM, -1, "key.actuallyadditions.category");
|
||||||
|
|
||||||
|
public static void init(IEventBus modBus) {
|
||||||
|
NeoForge.EVENT_BUS.addListener(ActuallyAdditionsClient::onClientTick);
|
||||||
|
modBus.addListener(ActuallyAdditionsClient::registerKeyBinding);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setupMenus(RegisterMenuScreensEvent evt) {
|
public static void setupMenus(RegisterMenuScreensEvent evt) {
|
||||||
evt.register(ActuallyContainers.SACK_CONTAINER.get(), SackGui::new);
|
evt.register(ActuallyContainers.SACK_CONTAINER.get(), SackGui::new);
|
||||||
evt.register(ActuallyContainers.VOID_SACK_CONTAINER.get(), VoidSackGui::new);
|
evt.register(ActuallyContainers.VOID_SACK_CONTAINER.get(), VoidSackGui::new);
|
||||||
|
@ -158,4 +171,14 @@ public class ActuallyAdditionsClient {
|
||||||
assert Minecraft.getInstance().hitResult != null;
|
assert Minecraft.getInstance().hitResult != null;
|
||||||
connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockHitResult) Minecraft.getInstance().hitResult).getDirection()));
|
connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockHitResult) Minecraft.getInstance().hitResult).getDirection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void onClientTick(ClientTickEvent.Post event) {
|
||||||
|
if (OPEN_CRAFTING_KEY.consumeClick()) {
|
||||||
|
PacketDistributor.sendToServer(new HotkeyPacket(HotkeyPacket.HotKey.OPEN_CRAFTING_STICK));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerKeyBinding(final RegisterKeyMappingsEvent event) {
|
||||||
|
event.register(OPEN_CRAFTING_KEY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,14 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHelperClient;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHelperClient;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToContainerPacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
|
@ -84,11 +82,8 @@ public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItem
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buttonClicked(int id) {
|
public void buttonClicked(int id) {
|
||||||
CompoundTag data = new CompoundTag();
|
PacketDistributor.sendToServer(new ButtonToContainerPacket(
|
||||||
data.putInt("ButtonID", id);
|
Minecraft.getInstance().level.dimension().location(), Minecraft.getInstance().player.getId(), id));
|
||||||
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
|
||||||
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
|
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,13 +12,11 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToTilePacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
@ -27,7 +25,6 @@ import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class GuiRangedCollector extends AAScreen<ContainerRangedCollector> {
|
public class GuiRangedCollector extends AAScreen<ContainerRangedCollector> {
|
||||||
|
|
||||||
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_ranged_collector");
|
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_ranged_collector");
|
||||||
|
@ -73,14 +70,8 @@ public class GuiRangedCollector extends AAScreen<ContainerRangedCollector> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buttonClicked(int id) {
|
public void buttonClicked(int id) {
|
||||||
CompoundTag data = new CompoundTag();
|
PacketDistributor.sendToServer(new ButtonToTilePacket(collector.getLevel().dimension().location(),
|
||||||
data.putInt("ButtonID", id);
|
this.collector.getBlockPos(), Minecraft.getInstance().player.getId(), id));
|
||||||
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
|
||||||
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
|
|
||||||
data.putInt("X", this.collector.getBlockPos().getX());
|
|
||||||
data.putInt("Y", this.collector.getBlockPos().getY());
|
|
||||||
data.putInt("Z", this.collector.getBlockPos().getZ());
|
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ItemTagContainer;
|
import de.ellpeck.actuallyadditions.mod.inventory.ItemTagContainer;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToContainerPacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
import net.minecraft.client.gui.components.StringWidget;
|
import net.minecraft.client.gui.components.StringWidget;
|
||||||
import net.minecraft.core.HolderSet;
|
import net.minecraft.core.HolderSet;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
|
@ -81,12 +78,13 @@ public class ItemTagScreen extends AAScreen<ItemTagContainer> {
|
||||||
this.minecraft.player.closeContainer();
|
this.minecraft.player.closeContainer();
|
||||||
}
|
}
|
||||||
if (pKeyCode == GLFW.GLFW_KEY_ENTER && validTag) {
|
if (pKeyCode == GLFW.GLFW_KEY_ENTER && validTag) {
|
||||||
CompoundTag data = new CompoundTag();
|
// data.putString("Tag", tagBox.getValue()); TODO: This value was never used by the old packet (GUI_BUTTON_TO_CONTAINER_HANDLER)
|
||||||
data.putInt("ButtonID", 0);
|
PacketDistributor.sendToServer(new ButtonToContainerPacket(
|
||||||
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
minecraft.level.dimension().location(),
|
||||||
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
|
minecraft.player.getId(),
|
||||||
data.putString("Tag", tagBox.getValue());
|
0
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
|
));
|
||||||
|
|
||||||
this.minecraft.player.closeContainer();
|
this.minecraft.player.closeContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,12 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.SackContainer;
|
import de.ellpeck.actuallyadditions.mod.inventory.SackContainer;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToContainerPacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
@ -65,11 +63,11 @@ public class SackGui extends AAScreen<SackContainer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buttonClicked(int id) {
|
public void buttonClicked(int id) {
|
||||||
CompoundTag data = new CompoundTag();
|
PacketDistributor.sendToServer(new ButtonToContainerPacket(
|
||||||
data.putInt("ButtonID", id);
|
Minecraft.getInstance().level.dimension().location(),
|
||||||
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
Minecraft.getInstance().player.getId(),
|
||||||
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
|
id
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,14 +12,11 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.VoidSackContainer;
|
import de.ellpeck.actuallyadditions.mod.inventory.VoidSackContainer;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToContainerPacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
@ -65,11 +62,11 @@ public class VoidSackGui extends AAScreen<VoidSackContainer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buttonClicked(int id) {
|
public void buttonClicked(int id) {
|
||||||
CompoundTag data = new CompoundTag();
|
PacketDistributor.sendToServer(new ButtonToContainerPacket(
|
||||||
data.putInt("ButtonID", id);
|
minecraft.level.dimension().location(),
|
||||||
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
minecraft.player.getId(),
|
||||||
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
|
id
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,16 +11,21 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.InteractionResultHolder;
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
import net.minecraft.world.SimpleMenuProvider;
|
import net.minecraft.world.SimpleMenuProvider;
|
||||||
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.ContainerLevelAccess;
|
import net.minecraft.world.inventory.ContainerLevelAccess;
|
||||||
import net.minecraft.world.inventory.CraftingMenu;
|
import net.minecraft.world.inventory.CraftingMenu;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import top.theillusivec4.curios.api.CuriosApi;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -35,13 +40,46 @@ public class ItemCrafterOnAStick extends ItemBase {
|
||||||
@Override
|
@Override
|
||||||
public InteractionResultHolder<ItemStack> use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) {
|
public InteractionResultHolder<ItemStack> use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
player.openMenu(new SimpleMenuProvider((windowId, playerInventory, playerEntity) -> new CraftingMenu(windowId, playerInventory, ContainerLevelAccess.create(world, player.blockPosition())){
|
openCraftingMenu(player);
|
||||||
@Override
|
|
||||||
public boolean stillValid(Player playerIn) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}, CONTAINER_TITLE));
|
|
||||||
}
|
}
|
||||||
return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand));
|
return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void openCraftingMenu(Player player) {
|
||||||
|
if (!(player instanceof ServerPlayer))
|
||||||
|
return;
|
||||||
|
player.openMenu(new SimpleMenuProvider((windowId, playerInventory, playerEntity) -> new CraftingMenu(windowId, playerInventory, ContainerLevelAccess.create(player.level(), player.blockPosition())){
|
||||||
|
@Override
|
||||||
|
public boolean stillValid(@NotNull Player playerIn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, CONTAINER_TITLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasCrafterOnAStick(@Nonnull Player player) {
|
||||||
|
if (player.getMainHandItem().getItem() instanceof ItemCrafterOnAStick || player.getOffhandItem().getItem() instanceof ItemCrafterOnAStick) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.curiosLoaded) {
|
||||||
|
var curiosInv = CuriosApi.getCuriosInventory(player);
|
||||||
|
if (curiosInv.isPresent()) {
|
||||||
|
if(curiosInv.get().findFirstCurio(ItemCrafterOnAStick::isCrafterOnAStick).isPresent())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Inventory inventory = player.getInventory();
|
||||||
|
for (int i = 0; i <= 35; i++) {
|
||||||
|
ItemStack stack = inventory.getItem(i);
|
||||||
|
if (stack.getItem() instanceof ItemCrafterOnAStick)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isCrafterOnAStick(@Nonnull ItemStack stack) {
|
||||||
|
return stack.getItem() instanceof ItemCrafterOnAStick;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IDataHandler.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.network;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
|
||||||
|
|
||||||
public interface IDataHandler {
|
|
||||||
|
|
||||||
void handleData(CompoundTag compound, IPayloadContext context);
|
|
||||||
|
|
||||||
}
|
|
|
@ -11,159 +11,30 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.network;
|
package de.ellpeck.actuallyadditions.mod.network;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
import de.ellpeck.actuallyadditions.mod.network.handler.ClientPayloadHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
import de.ellpeck.actuallyadditions.mod.network.handler.ServerPayloadHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
import de.ellpeck.actuallyadditions.mod.network.packet.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketServerToClient;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.protocol.PacketFlow;
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
import net.neoforged.neoforge.network.handling.DirectionalPayloadHandler;
|
||||||
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public final class PacketHandler {
|
public final class PacketHandler {
|
||||||
|
|
||||||
public static final List<IDataHandler> DATA_HANDLERS = new ArrayList<>();
|
|
||||||
public static final IDataHandler LASER_HANDLER = new IDataHandler() {
|
|
||||||
@Override
|
|
||||||
public void handleData(CompoundTag compound, IPayloadContext context) {
|
|
||||||
if(context.flow() == PacketFlow.CLIENTBOUND) {
|
|
||||||
PacketHelperClient.handleLaser(compound, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler() {
|
|
||||||
@Override
|
|
||||||
public void handleData(CompoundTag compound, IPayloadContext context) {
|
|
||||||
if(context.flow() == PacketFlow.CLIENTBOUND) {
|
|
||||||
PacketHelperClient.handleTileUpdate(compound, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler LASER_PARTICLE_HANDLER = new IDataHandler() {
|
|
||||||
@Override
|
|
||||||
public void handleData(CompoundTag compound, IPayloadContext context) {
|
|
||||||
if(context.flow() == PacketFlow.CLIENTBOUND) {
|
|
||||||
PacketHelperClient.handleLaserParticle(compound, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> {
|
|
||||||
if (context.player() != null) {
|
|
||||||
Player player = context.player();
|
|
||||||
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(compound.getString("WorldID"))));
|
|
||||||
BlockEntity tile = level.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z")));
|
|
||||||
|
|
||||||
if (tile instanceof IButtonReactor reactor) {
|
|
||||||
Entity entity = level.getEntity(compound.getInt("PlayerID"));
|
|
||||||
if (entity instanceof Player) {
|
|
||||||
reactor.onButtonPressed(compound.getInt("ButtonID"), (Player) entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler GUI_BUTTON_TO_CONTAINER_HANDLER = (compound, context) -> {
|
|
||||||
if (context.player() != null) {
|
|
||||||
Player player = context.player();
|
|
||||||
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(compound.getString("WorldID"))));
|
|
||||||
Entity entity = level.getEntity(compound.getInt("PlayerID"));
|
|
||||||
if (entity instanceof Player p) {
|
|
||||||
AbstractContainerMenu container = p.containerMenu;
|
|
||||||
if (container instanceof IButtonReactor reactor) {
|
|
||||||
reactor.onButtonPressed(compound.getInt("ButtonID"), (Player) entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler GUI_NUMBER_TO_TILE_HANDLER = (compound, context) -> {
|
|
||||||
if (context.player() != null) {
|
|
||||||
Player player = context.player();
|
|
||||||
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(compound.getString("WorldID"))));
|
|
||||||
BlockEntity tile = level.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z")));
|
|
||||||
|
|
||||||
if (tile instanceof INumberReactor reactor) {
|
|
||||||
reactor.onNumberReceived(compound.getDouble("Number"), compound.getInt("NumberID"), (Player) level.getEntity(compound.getInt("PlayerID")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler GUI_STRING_TO_TILE_HANDLER = (compound, context) -> {
|
|
||||||
if (context.player() != null) {
|
|
||||||
Player player = context.player();
|
|
||||||
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(compound.getString("WorldID"))));
|
|
||||||
BlockEntity tile = level.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z")));
|
|
||||||
|
|
||||||
if (tile instanceof IStringReactor reactor) {
|
|
||||||
reactor.onTextReceived(compound.getString("Text"), compound.getInt("TextID"), (Player) level.getEntity(compound.getInt("PlayerID")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler SYNC_PLAYER_DATA = new IDataHandler() {
|
|
||||||
@Override
|
|
||||||
public void handleData(CompoundTag compound, IPayloadContext context) {
|
|
||||||
if(context.flow() == PacketFlow.CLIENTBOUND) {
|
|
||||||
PacketHelperClient.handlePlayerUpdate(compound, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static final IDataHandler PLAYER_DATA_TO_SERVER = (compound, context) -> {
|
|
||||||
if (context.player() != null) {
|
|
||||||
Level level = context.player().getServer().getLevel(ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(compound.getString("World"))));
|
|
||||||
Player player = level.getServer().getPlayerList().getPlayer(compound.getUUID("UUID"));
|
|
||||||
if (player != null) {
|
|
||||||
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
|
||||||
|
|
||||||
int type = compound.getInt("Type");
|
|
||||||
if (type == 0) {
|
|
||||||
data.loadBookmarks(compound.getList("Bookmarks", 8));
|
|
||||||
} else if (type == 1) {
|
|
||||||
data.didBookTutorial = compound.getBoolean("DidBookTutorial");
|
|
||||||
} else if (type == 2) {
|
|
||||||
data.loadTrials(compound.getList("Trials", 8));
|
|
||||||
|
|
||||||
if (compound.getBoolean("Achievement")) {
|
|
||||||
//TheAchievements.COMPLETE_TRIALS.get(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WorldData.get(level).setDirty();
|
|
||||||
|
|
||||||
if (compound.getBoolean("Log")) {
|
|
||||||
ActuallyAdditions.LOGGER.info("Receiving changed Player Data for player {}.", player.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ActuallyAdditions.LOGGER.error("Tried to receive Player Data for UUID {}, but he doesn't seem to be present!", compound.getUUID("UUID"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static void register(final RegisterPayloadHandlersEvent event) {
|
public static void register(final RegisterPayloadHandlersEvent event) {
|
||||||
final PayloadRegistrar registrar = event.registrar(ActuallyAdditions.MODID);
|
final PayloadRegistrar registrar = event.registrar(ActuallyAdditions.MODID);
|
||||||
|
|
||||||
registrar.playToClient(PacketServerToClient.ID, PacketServerToClient.CODEC, PacketServerToClient::handle);
|
registrar.playToClient(SpawnLaserPacket.ID, SpawnLaserPacket.CODEC, ClientPayloadHandler.getInstance()::handleSpawnLaser);
|
||||||
registrar.playToServer(PacketClientToServer.ID, PacketClientToServer.CODEC, PacketClientToServer::handle);
|
registrar.playToClient(SpawnLaserParticlePacket.ID, SpawnLaserParticlePacket.CODEC, ClientPayloadHandler.getInstance()::handleSpawnLaserParticle);
|
||||||
|
registrar.playToClient(TileUpdatePacket.ID, TileUpdatePacket.CODEC, ClientPayloadHandler.getInstance()::handleTileUpdate);
|
||||||
|
|
||||||
DATA_HANDLERS.add(LASER_HANDLER);
|
registrar.playToServer(ButtonToTilePacket.ID, ButtonToTilePacket.CODEC, ServerPayloadHandler.getInstance()::handleButtonToTile);
|
||||||
DATA_HANDLERS.add(TILE_ENTITY_HANDLER);
|
registrar.playToServer(StringToTilePacket.ID, StringToTilePacket.CODEC, ServerPayloadHandler.getInstance()::handleStringToTile);
|
||||||
DATA_HANDLERS.add(GUI_BUTTON_TO_TILE_HANDLER);
|
registrar.playToServer(NumberToTilePacket.ID, NumberToTilePacket.CODEC, ServerPayloadHandler.getInstance()::handleNumberToTile);
|
||||||
DATA_HANDLERS.add(GUI_STRING_TO_TILE_HANDLER);
|
registrar.playToServer(ButtonToContainerPacket.ID, ButtonToContainerPacket.CODEC, ServerPayloadHandler.getInstance()::handleButtonToContainer);
|
||||||
DATA_HANDLERS.add(GUI_NUMBER_TO_TILE_HANDLER);
|
registrar.playToServer(HotkeyPacket.TYPE, HotkeyPacket.CODEC, HotkeyPacket::handle);
|
||||||
DATA_HANDLERS.add(SYNC_PLAYER_DATA);
|
|
||||||
DATA_HANDLERS.add(GUI_BUTTON_TO_CONTAINER_HANDLER);
|
registrar.playBidirectional(SyncPlayerPacket.ID, SyncPlayerPacket.CODEC,
|
||||||
DATA_HANDLERS.add(LASER_PARTICLE_HANDLER);
|
new DirectionalPayloadHandler<>(ClientPayloadHandler.getInstance()::handleSyncPlayer, ServerPayloadHandler.getInstance()::handleSyncPlayer));
|
||||||
DATA_HANDLERS.add(PLAYER_DATA_TO_SERVER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,79 +12,24 @@ package de.ellpeck.actuallyadditions.mod.network;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketClientToServer;
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToTilePacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem;
|
import de.ellpeck.actuallyadditions.mod.network.packet.NumberToTilePacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.network.packet.SyncPlayerPacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
|
||||||
|
|
||||||
public final class PacketHelperClient {
|
public final class PacketHelperClient {
|
||||||
public static void handleLaser(CompoundTag compound, IPayloadContext context) {
|
|
||||||
AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), compound.getInt("Color"), compound.getInt("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleTileUpdate(CompoundTag compound, IPayloadContext context) {
|
|
||||||
Level world = Minecraft.getInstance().level;
|
|
||||||
if (world != null) {
|
|
||||||
BlockEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z")));
|
|
||||||
if (tile instanceof TileEntityBase tileBase) {
|
|
||||||
tileBase.readSyncableNBT(compound.getCompound("Data"), world.registryAccess(), TileEntityBase.NBTType.SYNC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleLaserParticle(CompoundTag compound, IPayloadContext context) {
|
|
||||||
Minecraft mc = Minecraft.getInstance();
|
|
||||||
ItemStack stack = ItemStack.parseOptional(context.player().registryAccess(), compound);
|
|
||||||
|
|
||||||
double inX = compound.getDouble("InX") + 0.5;
|
|
||||||
double inY = compound.getDouble("InY") + 0.78;
|
|
||||||
double inZ = compound.getDouble("InZ") + 0.5;
|
|
||||||
|
|
||||||
double outX = compound.getDouble("OutX") + 0.5;
|
|
||||||
double outY = compound.getDouble("OutY") + 0.525;
|
|
||||||
double outZ = compound.getDouble("OutZ") + 0.5;
|
|
||||||
|
|
||||||
mc.level.addParticle(ParticleLaserItem.Factory.createData(stack, inX, inY, inZ),
|
|
||||||
outX, outY, outZ, 0, 0.025, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handlePlayerUpdate(CompoundTag compound, IPayloadContext context) {
|
|
||||||
CompoundTag dataTag = compound.getCompound("Data");
|
|
||||||
Player player = context.player(); //ActuallyAdditions.PROXY.getCurrentPlayer();
|
|
||||||
|
|
||||||
if (player != null) {
|
|
||||||
PlayerData.getDataFromPlayer(player).readFromNBT(dataTag, false);
|
|
||||||
|
|
||||||
if (compound.getBoolean("Log")) {
|
|
||||||
ActuallyAdditions.LOGGER.info("Receiving (new or changed) Player Data for player {}.", player.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ActuallyAdditions.LOGGER.error("Tried to receive Player Data for the current player, but he doesn't seem to be present!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendButtonPacket(BlockEntity tile, int buttonId) {
|
public static void sendButtonPacket(BlockEntity tile, int buttonId) {
|
||||||
CompoundTag compound = new CompoundTag();
|
|
||||||
BlockPos pos = tile.getBlockPos();
|
BlockPos pos = tile.getBlockPos();
|
||||||
compound.putInt("X", pos.getX());
|
PacketDistributor.sendToServer(new ButtonToTilePacket(tile.getLevel().dimension().location(),
|
||||||
compound.putInt("Y", pos.getY());
|
pos, Minecraft.getInstance().player.getId(), buttonId));
|
||||||
compound.putInt("Z", pos.getZ());
|
|
||||||
compound.putString("WorldID", tile.getLevel().dimension().location().toString());
|
|
||||||
compound.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
|
||||||
compound.putInt("ButtonID", buttonId);
|
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerDataToServer(boolean log, int type) {
|
public static void sendPlayerDataToServer(boolean log, int type) {
|
||||||
|
@ -118,20 +63,14 @@ public final class PacketHelperClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(compound, PacketHandler.PLAYER_DATA_TO_SERVER));
|
PacketDistributor.sendToServer(new SyncPlayerPacket(compound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void sendNumberPacket(BlockEntity tile, double number, int id) {
|
public static void sendNumberPacket(BlockEntity tile, double number, int id) {
|
||||||
CompoundTag compound = new CompoundTag();
|
PacketDistributor.sendToServer(new NumberToTilePacket(
|
||||||
compound.putInt("X", tile.getBlockPos().getX());
|
tile.getLevel().dimension().location(), tile.getBlockPos(), Minecraft.getInstance().player.getId(), number, id
|
||||||
compound.putInt("Y", tile.getBlockPos().getY());
|
));
|
||||||
compound.putInt("Z", tile.getBlockPos().getZ());
|
|
||||||
compound.putString("WorldID", tile.getLevel().dimension().location().toString());
|
|
||||||
compound.putInt("PlayerID", Minecraft.getInstance().player.getId());
|
|
||||||
compound.putInt("NumberID", id);
|
|
||||||
compound.putDouble("Number", number);
|
|
||||||
PacketDistributor.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_NUMBER_TO_TILE_HANDLER));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,13 @@ package de.ellpeck.actuallyadditions.mod.network;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketServerToClient;
|
import de.ellpeck.actuallyadditions.mod.network.packet.SpawnLaserPacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.SyncPlayerPacket;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for sending packets from the server to the client.
|
* A helper class for sending packets from the server to the client.
|
||||||
|
@ -32,7 +35,17 @@ public final class PacketHelperServer {
|
||||||
ActuallyAdditions.LOGGER.info("Sending data {}", data);
|
ActuallyAdditions.LOGGER.info("Sending data {}", data);
|
||||||
|
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.connection.send(new PacketServerToClient(compound, PacketHandler.SYNC_PLAYER_DATA));
|
serverPlayer.connection.send(new SyncPlayerPacket(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void spawnLaserWithTimeServer(ServerLevel world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) {
|
||||||
|
if (!world.isClientSide) {
|
||||||
|
PacketDistributor.sendToPlayersNear(world, null, startX, startY, startZ, 96, new SpawnLaserPacket(
|
||||||
|
startX, startY, startZ,
|
||||||
|
endX, endY, endZ,
|
||||||
|
color, maxAge, rotationTime, size, alpha
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.handler;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.SpawnLaserPacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.SpawnLaserParticlePacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.SyncPlayerPacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.TileUpdatePacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||||
|
|
||||||
|
public class ClientPayloadHandler {
|
||||||
|
private static final ClientPayloadHandler INSTANCE = new ClientPayloadHandler();
|
||||||
|
|
||||||
|
public static ClientPayloadHandler getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSpawnLaser(final SpawnLaserPacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.flow().isClientbound()) {
|
||||||
|
AssetUtil.spawnLaserWithTimeClient(
|
||||||
|
packet.startX(), packet.startY(), packet.startZ(),
|
||||||
|
packet.endX(), packet.endY(), packet.endZ(),
|
||||||
|
packet.color(), packet.maxAge(), packet.rotationTime(),
|
||||||
|
packet.size(), packet.alpha()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.spawn_laser.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSpawnLaserParticle(final SpawnLaserParticlePacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.flow().isClientbound()) {
|
||||||
|
Player player = context.player();
|
||||||
|
if (player != null) {
|
||||||
|
ItemStack stack = packet.stack();
|
||||||
|
|
||||||
|
BlockPos in = packet.in();
|
||||||
|
double inX = in.getX() + 0.5;
|
||||||
|
double inY = in.getY() + 0.78;
|
||||||
|
double inZ = in.getZ() + 0.5;
|
||||||
|
|
||||||
|
BlockPos out = packet.out();
|
||||||
|
double outX = out.getX() + 0.5;
|
||||||
|
double outY = out.getY() + 0.525;
|
||||||
|
double outZ = out.getZ() + 0.5;
|
||||||
|
|
||||||
|
player.level().addParticle(ParticleLaserItem.Factory.createData(stack, inX, inY, inZ),
|
||||||
|
outX, outY, outZ, 0, 0.025, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.spawn_laser_particle.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleTileUpdate(final TileUpdatePacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.flow().isClientbound()) {
|
||||||
|
Player player = context.player();
|
||||||
|
if (player != null) {
|
||||||
|
BlockEntity tile = player.level().getBlockEntity(packet.pos());
|
||||||
|
if (tile instanceof TileEntityBase tileBase) {
|
||||||
|
tileBase.readSyncableNBT(packet.data(), player.registryAccess(), TileEntityBase.NBTType.SYNC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.tile_update.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSyncPlayer(final SyncPlayerPacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.flow().isClientbound()) {
|
||||||
|
Player player = context.player(); //ActuallyAdditions.PROXY.getCurrentPlayer();
|
||||||
|
CompoundTag tag = packet.tag();
|
||||||
|
CompoundTag dataTag = tag.getCompound("Data");
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
PlayerData.getDataFromPlayer(player).readFromNBT(dataTag, false);
|
||||||
|
|
||||||
|
if (tag.getBoolean("Log")) {
|
||||||
|
ActuallyAdditions.LOGGER.info("Receiving (new or changed) Player Data for player {}.", player.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ActuallyAdditions.LOGGER.error("Tried to receive Player Data for the current player, but he doesn't seem to be present!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.sync_player_client.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,152 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.handler;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToContainerPacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.ButtonToTilePacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.NumberToTilePacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.StringToTilePacket;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.packet.SyncPlayerPacket;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||||
|
|
||||||
|
public class ServerPayloadHandler {
|
||||||
|
public static final ServerPayloadHandler INSTANCE = new ServerPayloadHandler();
|
||||||
|
|
||||||
|
public static ServerPayloadHandler getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleButtonToTile(final ButtonToTilePacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.player() != null) {
|
||||||
|
Player player = context.player();
|
||||||
|
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, packet.dimension()));
|
||||||
|
BlockEntity tile = level.getBlockEntity(packet.pos());
|
||||||
|
|
||||||
|
if (tile instanceof IButtonReactor reactor) {
|
||||||
|
Entity entity = level.getEntity(packet.playerId());
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
reactor.onButtonPressed(packet.buttonId(), (Player) entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.button_to_tile.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleStringToTile(final StringToTilePacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.player() != null) {
|
||||||
|
Player player = context.player();
|
||||||
|
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, packet.dimension()));
|
||||||
|
BlockEntity tile = level.getBlockEntity(packet.pos());
|
||||||
|
|
||||||
|
if (tile instanceof IStringReactor reactor) {
|
||||||
|
reactor.onTextReceived(packet.text(), packet.textId(), (Player) level.getEntity(packet.playerId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.string_to_tile.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleNumberToTile(final NumberToTilePacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.player() != null) {
|
||||||
|
Player player = context.player();
|
||||||
|
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, packet.dimension()));
|
||||||
|
BlockEntity tile = level.getBlockEntity(packet.pos());
|
||||||
|
|
||||||
|
if (tile instanceof INumberReactor reactor) {
|
||||||
|
reactor.onNumberReceived(packet.number(), packet.numberId(), (Player) level.getEntity(packet.playerId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.number_to_tile.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleButtonToContainer(final ButtonToContainerPacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.player() != null) {
|
||||||
|
Player player = context.player();
|
||||||
|
Level level = player.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, packet.dimension()));
|
||||||
|
Entity entity = level.getEntity(packet.playerId());
|
||||||
|
if (entity instanceof Player p) {
|
||||||
|
AbstractContainerMenu container = p.containerMenu;
|
||||||
|
if (container instanceof IButtonReactor reactor) {
|
||||||
|
reactor.onButtonPressed(packet.buttonId(), (Player) entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.button_to_container.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSyncPlayer(final SyncPlayerPacket packet, final IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
if (context.player() != null) {
|
||||||
|
CompoundTag tag = packet.tag();
|
||||||
|
Level level = context.player().getServer().getLevel(ResourceKey.create(Registries.DIMENSION,
|
||||||
|
ResourceLocation.tryParse(tag.getString("World"))));
|
||||||
|
Player player = level.getServer().getPlayerList().getPlayer(tag.getUUID("UUID"));
|
||||||
|
if (player != null) {
|
||||||
|
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||||
|
|
||||||
|
int type = tag.getInt("Type");
|
||||||
|
if (type == 0) {
|
||||||
|
data.loadBookmarks(tag.getList("Bookmarks", 8));
|
||||||
|
} else if (type == 1) {
|
||||||
|
data.didBookTutorial = tag.getBoolean("DidBookTutorial");
|
||||||
|
} else if (type == 2) {
|
||||||
|
data.loadTrials(tag.getList("Trials", 8));
|
||||||
|
|
||||||
|
if (tag.getBoolean("Achievement")) {
|
||||||
|
//TheAchievements.COMPLETE_TRIALS.get(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WorldData.get(level).setDirty();
|
||||||
|
|
||||||
|
if (tag.getBoolean("Log")) {
|
||||||
|
ActuallyAdditions.LOGGER.info("Receiving changed Player Data for player {}.", player.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ActuallyAdditions.LOGGER.error("Tried to receive Player Data for UUID {}, but he doesn't seem to be present!", tag.getUUID("UUID"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exceptionally(e -> {
|
||||||
|
// Handle exception
|
||||||
|
context.disconnect(Component.translatable("actuallyadditions.networking.sync_player.failed", e.getMessage()));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record ButtonToContainerPacket(ResourceLocation dimension, int playerId, int buttonId) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, ButtonToContainerPacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
ButtonToContainerPacket::write,
|
||||||
|
ButtonToContainerPacket::new);
|
||||||
|
public static final Type<ButtonToContainerPacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "button_to_container"));
|
||||||
|
|
||||||
|
|
||||||
|
public ButtonToContainerPacket(FriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
ResourceLocation.STREAM_CODEC.decode(buf),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
ResourceLocation.STREAM_CODEC.encode(buf, dimension);
|
||||||
|
buf.writeInt(playerId);
|
||||||
|
buf.writeInt(buttonId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record ButtonToTilePacket(ResourceLocation dimension, BlockPos pos, int playerId,
|
||||||
|
int buttonId) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, ButtonToTilePacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
ButtonToTilePacket::write,
|
||||||
|
ButtonToTilePacket::new);
|
||||||
|
public static final Type<ButtonToTilePacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "button_to_tile"));
|
||||||
|
|
||||||
|
|
||||||
|
public ButtonToTilePacket(FriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
ResourceLocation.STREAM_CODEC.decode(buf),
|
||||||
|
BlockPos.STREAM_CODEC.decode(buf),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
ResourceLocation.STREAM_CODEC.encode(buf, dimension);
|
||||||
|
BlockPos.STREAM_CODEC.encode(buf, pos);
|
||||||
|
buf.writeInt(playerId);
|
||||||
|
buf.writeInt(buttonId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.ItemCrafterOnAStick;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||||
|
|
||||||
|
public record HotkeyPacket(HotKey hotKey) implements CustomPacketPayload {
|
||||||
|
public static final Type<HotkeyPacket> TYPE = new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "hotkey"));
|
||||||
|
|
||||||
|
public HotkeyPacket(byte type) {
|
||||||
|
this(HotKey.values()[type]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum HotKey {
|
||||||
|
OPEN_CRAFTING_STICK
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, HotkeyPacket> CODEC = StreamCodec.composite(
|
||||||
|
ByteBufCodecs.BYTE, packet -> ((byte) packet.hotKey.ordinal()),
|
||||||
|
HotkeyPacket::new
|
||||||
|
);
|
||||||
|
|
||||||
|
public static void handle(final HotkeyPacket packet, IPayloadContext ctx) {
|
||||||
|
switch (packet.hotKey) {
|
||||||
|
case OPEN_CRAFTING_STICK -> ctx.enqueueWork(() -> open(ctx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void open(IPayloadContext ctx) {
|
||||||
|
Player player = ctx.player();
|
||||||
|
|
||||||
|
if (ItemCrafterOnAStick.hasCrafterOnAStick(player)) {
|
||||||
|
ItemCrafterOnAStick.openCraftingMenu(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record NumberToTilePacket(ResourceLocation dimension, BlockPos pos, int playerId,
|
||||||
|
double number, int numberId) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, NumberToTilePacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
NumberToTilePacket::write,
|
||||||
|
NumberToTilePacket::new);
|
||||||
|
public static final Type<NumberToTilePacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "number_to_tile"));
|
||||||
|
|
||||||
|
|
||||||
|
public NumberToTilePacket(FriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
ResourceLocation.STREAM_CODEC.decode(buf),
|
||||||
|
BlockPos.STREAM_CODEC.decode(buf),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readInt()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
ResourceLocation.STREAM_CODEC.encode(buf, dimension);
|
||||||
|
BlockPos.STREAM_CODEC.encode(buf, pos);
|
||||||
|
buf.writeInt(playerId);
|
||||||
|
buf.writeDouble(number);
|
||||||
|
buf.writeInt(numberId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PacketClientToServer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.network.packet;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.IDataHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
|
||||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
public record PacketClientToServer(CompoundTag data, IDataHandler handler) implements CustomPacketPayload {
|
|
||||||
public static final StreamCodec<FriendlyByteBuf, PacketClientToServer> CODEC = CustomPacketPayload.codec(
|
|
||||||
PacketClientToServer::write,
|
|
||||||
PacketClientToServer::new);
|
|
||||||
public static final Type<PacketClientToServer> ID = new Type<>(ActuallyAdditions.modLoc("client_to_server"));
|
|
||||||
|
|
||||||
public PacketClientToServer(Pair<CompoundTag, IDataHandler> data) {
|
|
||||||
this(data.getLeft(), data.getRight());
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketClientToServer(final FriendlyByteBuf buffer) {
|
|
||||||
this(fromBytes(buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Pair<CompoundTag, IDataHandler> fromBytes(FriendlyByteBuf buffer) {
|
|
||||||
try {
|
|
||||||
CompoundTag data = buffer.readNbt();
|
|
||||||
|
|
||||||
int handlerId = buffer.readInt();
|
|
||||||
if (handlerId >= 0 && handlerId < PacketHandler.DATA_HANDLERS.size()) {
|
|
||||||
return Pair.of(data, PacketHandler.DATA_HANDLERS.get(handlerId));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to receive a server packet!", e);
|
|
||||||
}
|
|
||||||
return Pair.of(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(FriendlyByteBuf buf) {
|
|
||||||
buf.writeNbt(data);
|
|
||||||
buf.writeInt(PacketHandler.DATA_HANDLERS.indexOf(handler));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handle(final PacketClientToServer message, final IPayloadContext context) {
|
|
||||||
context.enqueueWork(
|
|
||||||
() -> {
|
|
||||||
if (message.data != null && message.handler != null) {
|
|
||||||
message.handler.handleData(message.data, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Type<? extends CustomPacketPayload> type() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("PacketServerToClient.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.network.packet;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.IDataHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
|
||||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
|
|
||||||
public record PacketServerToClient(CompoundTag data, IDataHandler handler) implements CustomPacketPayload {
|
|
||||||
public static final StreamCodec<FriendlyByteBuf, PacketServerToClient> CODEC = CustomPacketPayload.codec(
|
|
||||||
PacketServerToClient::write,
|
|
||||||
PacketServerToClient::new);
|
|
||||||
public static final Type<PacketServerToClient> ID = new Type<>(ActuallyAdditions.modLoc("server_to_client"));
|
|
||||||
|
|
||||||
public PacketServerToClient(Pair<CompoundTag, IDataHandler> data) {
|
|
||||||
this(data.getLeft(), data.getRight());
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketServerToClient(final FriendlyByteBuf buffer) {
|
|
||||||
this(fromBytes(buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Pair<CompoundTag, IDataHandler> fromBytes(FriendlyByteBuf buffer) {
|
|
||||||
try {
|
|
||||||
CompoundTag data = buffer.readNbt();
|
|
||||||
|
|
||||||
int handlerId = buffer.readInt();
|
|
||||||
if (handlerId >= 0 && handlerId < PacketHandler.DATA_HANDLERS.size()) {
|
|
||||||
return Pair.of(data, PacketHandler.DATA_HANDLERS.get(handlerId));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to receive a client packet!", e);
|
|
||||||
}
|
|
||||||
return Pair.of(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(FriendlyByteBuf buf) {
|
|
||||||
buf.writeNbt(data);
|
|
||||||
buf.writeInt(PacketHandler.DATA_HANDLERS.indexOf(handler));
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Type<? extends CustomPacketPayload> type() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handle(final PacketServerToClient message, final IPayloadContext context) {
|
|
||||||
context.enqueueWork(
|
|
||||||
() -> {
|
|
||||||
if (message.data != null && message.handler != null) {
|
|
||||||
message.handler.handleData(message.data, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record SpawnLaserPacket(double startX, double startY, double startZ,
|
||||||
|
double endX, double endY, double endZ,
|
||||||
|
int color, int maxAge, double rotationTime, float size,
|
||||||
|
float alpha) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, SpawnLaserPacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
SpawnLaserPacket::write,
|
||||||
|
SpawnLaserPacket::new);
|
||||||
|
public static final Type<SpawnLaserPacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "spawn_laser"));
|
||||||
|
|
||||||
|
|
||||||
|
public SpawnLaserPacket(FriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readDouble(),
|
||||||
|
buf.readFloat(),
|
||||||
|
buf.readFloat()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
buf.writeDouble(startX);
|
||||||
|
buf.writeDouble(startY);
|
||||||
|
buf.writeDouble(startZ);
|
||||||
|
buf.writeDouble(endX);
|
||||||
|
buf.writeDouble(endY);
|
||||||
|
buf.writeDouble(endZ);
|
||||||
|
buf.writeInt(color);
|
||||||
|
buf.writeInt(maxAge);
|
||||||
|
buf.writeDouble(rotationTime);
|
||||||
|
buf.writeFloat(size);
|
||||||
|
buf.writeFloat(alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
public record SpawnLaserParticlePacket(ItemStack stack, BlockPos in, BlockPos out) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<RegistryFriendlyByteBuf, SpawnLaserParticlePacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
SpawnLaserParticlePacket::write,
|
||||||
|
SpawnLaserParticlePacket::new);
|
||||||
|
public static final Type<SpawnLaserParticlePacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "spawn_laser_particle"));
|
||||||
|
|
||||||
|
|
||||||
|
public SpawnLaserParticlePacket(RegistryFriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
ItemStack.STREAM_CODEC.decode(buf),
|
||||||
|
BlockPos.STREAM_CODEC.decode(buf),
|
||||||
|
BlockPos.STREAM_CODEC.decode(buf)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(RegistryFriendlyByteBuf buf) {
|
||||||
|
ItemStack.STREAM_CODEC.encode(buf, stack);
|
||||||
|
BlockPos.STREAM_CODEC.encode(buf, in);
|
||||||
|
BlockPos.STREAM_CODEC.encode(buf, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record StringToTilePacket(ResourceLocation dimension, BlockPos pos, int playerId,
|
||||||
|
String text, int textId) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, StringToTilePacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
StringToTilePacket::write,
|
||||||
|
StringToTilePacket::new);
|
||||||
|
public static final Type<StringToTilePacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "string_to_tile"));
|
||||||
|
|
||||||
|
|
||||||
|
public StringToTilePacket(FriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
ResourceLocation.STREAM_CODEC.decode(buf),
|
||||||
|
BlockPos.STREAM_CODEC.decode(buf),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readUtf(),
|
||||||
|
buf.readInt()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
ResourceLocation.STREAM_CODEC.encode(buf, dimension);
|
||||||
|
BlockPos.STREAM_CODEC.encode(buf, pos);
|
||||||
|
buf.writeInt(playerId);
|
||||||
|
buf.writeUtf(text);
|
||||||
|
buf.writeInt(textId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record SyncPlayerPacket(CompoundTag tag) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, SyncPlayerPacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
SyncPlayerPacket::write,
|
||||||
|
SyncPlayerPacket::new);
|
||||||
|
public static final Type<SyncPlayerPacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "sync_player"));
|
||||||
|
|
||||||
|
|
||||||
|
public SyncPlayerPacket(FriendlyByteBuf buf) {
|
||||||
|
this(buf.readNbt());
|
||||||
|
}
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
buf.writeNbt(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.network.packet;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
public record TileUpdatePacket(BlockPos pos, CompoundTag data) implements CustomPacketPayload {
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, TileUpdatePacket> CODEC = CustomPacketPayload.codec(
|
||||||
|
TileUpdatePacket::write,
|
||||||
|
TileUpdatePacket::new);
|
||||||
|
public static final Type<TileUpdatePacket> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(ActuallyAdditions.MODID, "tile_update"));
|
||||||
|
|
||||||
|
|
||||||
|
public TileUpdatePacket(FriendlyByteBuf buf) {
|
||||||
|
this(
|
||||||
|
buf.readBlockPos(),
|
||||||
|
buf.readNbt()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
buf.writeBlockPos(pos);
|
||||||
|
buf.writeNbt(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.mod.AASounds;
|
import de.ellpeck.actuallyadditions.mod.AASounds;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHelperServer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -53,7 +53,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
|
|
||||||
public static void shootLaser(IAtomicReconstructor tile, ServerLevel world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens) {
|
public static void shootLaser(IAtomicReconstructor tile, ServerLevel world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens) {
|
||||||
world.playSound(null, startX, startY, startZ, AASounds.RECONSTRUCTOR.get(), SoundSource.BLOCKS, 0.35F, 1.0F);
|
world.playSound(null, startX, startY, startZ, AASounds.RECONSTRUCTOR.get(), SoundSource.BLOCKS, 0.35F, 1.0F);
|
||||||
AssetUtil.spawnLaserWithTimeServer(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), 25, 0, 0.2F, 0.8F);
|
PacketHelperServer.spawnLaserWithTimeServer(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), 25, 0, 0.2F, 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,14 +12,12 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.packet.SpawnLaserParticlePacket;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketServerToClient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
|
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -162,22 +160,11 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
|
|
||||||
public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) {
|
public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) {
|
||||||
if (!this.level.isClientSide) {
|
if (!this.level.isClientSide) {
|
||||||
CompoundTag compound = new CompoundTag();
|
|
||||||
stack.save(this.level.registryAccess(), compound);
|
|
||||||
|
|
||||||
compound.putDouble("InX", input.getX());
|
|
||||||
compound.putDouble("InY", input.getY());
|
|
||||||
compound.putDouble("InZ", input.getZ());
|
|
||||||
|
|
||||||
compound.putDouble("OutX", output.getX());
|
|
||||||
compound.putDouble("OutY", output.getY());
|
|
||||||
compound.putDouble("OutZ", output.getZ());
|
|
||||||
|
|
||||||
int rangeSq = 16 * 16;
|
int rangeSq = 16 * 16;
|
||||||
for (Player player : this.level.players()) {
|
for (Player player : this.level.players()) {
|
||||||
if (player instanceof ServerPlayer) {
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) {
|
if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) {
|
||||||
((ServerPlayer) player).connection.send(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER));
|
serverPlayer.connection.send(new SpawnLaserParticlePacket(stack, input, output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHelperServer;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
|
@ -89,7 +89,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
|
||||||
|
|
||||||
tile.storage.receiveEnergyInternal(energyProduced, false);
|
tile.storage.receiveEnergyInternal(energyProduced, false);
|
||||||
|
|
||||||
AssetUtil.spawnLaserWithTimeServer((ServerLevel) level, pos.getX(), pos.getY(), pos.getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F);
|
PacketHelperServer.spawnLaserWithTimeServer((ServerLevel) level, pos.getX(), pos.getY(), pos.getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,8 +13,8 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.network.PacketHelperServer;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
|
@ -197,7 +197,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shootParticles(int endX, int endY, int endZ) {
|
private void shootParticles(int endX, int endY, int endZ) {
|
||||||
AssetUtil.spawnLaserWithTimeServer((ServerLevel) this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), endX, endY, endZ, 0x429602, 10, 120, 0.1F, 0.8F);
|
PacketHelperServer.spawnLaserWithTimeServer((ServerLevel) this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), endX, endY, endZ, 0x429602, 10, 120, 0.1F, 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBlacklisted(Block block) {
|
private boolean isBlacklisted(Block block) {
|
||||||
|
|
|
@ -16,8 +16,6 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.packet.PacketServerToClient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -33,9 +31,7 @@ import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
import net.minecraft.client.resources.model.BakedModel;
|
import net.minecraft.client.resources.model.BakedModel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.util.FastColor;
|
import net.minecraft.util.FastColor;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -47,7 +43,6 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.neoforged.neoforge.client.ClientHooks;
|
import net.neoforged.neoforge.client.ClientHooks;
|
||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
|
|
||||||
public final class AssetUtil {
|
public final class AssetUtil {
|
||||||
|
@ -216,24 +211,6 @@ public final class AssetUtil {
|
||||||
// GlStateManager._popMatrix();
|
// GlStateManager._popMatrix();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public static void spawnLaserWithTimeServer(ServerLevel world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) {
|
|
||||||
if (!world.isClientSide) {
|
|
||||||
CompoundTag data = new CompoundTag();
|
|
||||||
data.putDouble("StartX", startX);
|
|
||||||
data.putDouble("StartY", startY);
|
|
||||||
data.putDouble("StartZ", startZ);
|
|
||||||
data.putDouble("EndX", endX);
|
|
||||||
data.putDouble("EndY", endY);
|
|
||||||
data.putDouble("EndZ", endZ);
|
|
||||||
data.putInt("Color", color);
|
|
||||||
data.putDouble("RotationTime", rotationTime);
|
|
||||||
data.putFloat("Size", size);
|
|
||||||
data.putInt("MaxAge", maxAge);
|
|
||||||
data.putFloat("Alpha", alpha);
|
|
||||||
PacketDistributor.sendToPlayersNear(world, null, startX, startY, startZ, 96, new PacketServerToClient(data, PacketHandler.LASER_HANDLER));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) {
|
public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
|
@ -48,4 +48,6 @@ public final class Util {
|
||||||
AttributeInstance attribute = player.getAttribute(Attributes.BLOCK_INTERACTION_RANGE);
|
AttributeInstance attribute = player.getAttribute(Attributes.BLOCK_INTERACTION_RANGE);
|
||||||
return attribute == null ? 4.5d : attribute.getValue();
|
return attribute == null ? 4.5d : attribute.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean curiosLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ public final class VanillaPacketDispatcher {
|
||||||
|
|
||||||
//Don't call from the client.
|
//Don't call from the client.
|
||||||
public static void dispatchTEToNearbyPlayers(BlockEntity blockEntity) {
|
public static void dispatchTEToNearbyPlayers(BlockEntity blockEntity) {
|
||||||
|
if (blockEntity.getLevel().isClientSide) {
|
||||||
|
throw new IllegalArgumentException("Tried to dispatch a TileEntity packet on the client side! This is not allowed!");
|
||||||
|
}
|
||||||
ServerLevel serverLevel = (ServerLevel) blockEntity.getLevel();
|
ServerLevel serverLevel = (ServerLevel) blockEntity.getLevel();
|
||||||
LevelChunk chunk = serverLevel.getChunk(blockEntity.getBlockPos().getX() >> 4, blockEntity.getBlockPos().getZ() >> 4);
|
LevelChunk chunk = serverLevel.getChunk(blockEntity.getBlockPos().getX() >> 4, blockEntity.getBlockPos().getZ() >> 4);
|
||||||
|
|
||||||
|
|
|
@ -976,11 +976,24 @@
|
||||||
"booklet.actuallyadditions.chapter.trialsIntro": "Intro to Trials",
|
"booklet.actuallyadditions.chapter.trialsIntro": "Intro to Trials",
|
||||||
"booklet.actuallyadditions.chapter.trialsIntro.text.1": "<item>Trials<r> are a set of fun and interesting <imp>challenges<r> that you can use to <imp>get inspiration<r> on what to build next. <n>Once you <imp>complete<r> a <item>Trial<r>, you can <imp>press the button<r> in the bottom right to mark the trial as completed, turning its name in the list green. <n>Since there is <imp>no way to check<r> if a trial is actually completed, <item>Trials<r> are meant as <imp>personal goals<r>. <n><n>To <imp>visit<r> the <item>Trials<r> page, you can click the <imp>bookmark<r> in the <imp>top right<r> corner of the manual GUI.",
|
"booklet.actuallyadditions.chapter.trialsIntro.text.1": "<item>Trials<r> are a set of fun and interesting <imp>challenges<r> that you can use to <imp>get inspiration<r> on what to build next. <n>Once you <imp>complete<r> a <item>Trial<r>, you can <imp>press the button<r> in the bottom right to mark the trial as completed, turning its name in the list green. <n>Since there is <imp>no way to check<r> if a trial is actually completed, <item>Trials<r> are meant as <imp>personal goals<r>. <n><n>To <imp>visit<r> the <item>Trials<r> page, you can click the <imp>bookmark<r> in the <imp>top right<r> corner of the manual GUI.",
|
||||||
"booklet.actuallyadditions.chapter.trialsIntro.text.2": "Note that <item>Trials<r> are designed in a way that they should be completed with the concepts of <imp>Minecraft<r> and <imp>Actually Additions<r> alone.",
|
"booklet.actuallyadditions.chapter.trialsIntro.text.2": "Note that <item>Trials<r> are designed in a way that they should be completed with the concepts of <imp>Minecraft<r> and <imp>Actually Additions<r> alone.",
|
||||||
|
"_comment": "Networking",
|
||||||
|
"actuallyadditions.networking.spawn_laser.failed": "Failed to spawn laser: %s",
|
||||||
|
"actuallyadditions.networking.spawn_laser_particle.failed": "Failed to spawn laser particle: %s",
|
||||||
|
"actuallyadditions.networking.tile_update.failed": "Failed to update tile entity: %s",
|
||||||
|
"actuallyadditions.networking.sync_player_client.failed": "Failed to sync player data from client to server: %s",
|
||||||
|
"actuallyadditions.networking.sync_player.failed": "Failed to sync player data from server to client: %s",
|
||||||
|
"actuallyadditions.networking.button_to_tile.failed": "Failed to send button press to tile entity: %s",
|
||||||
|
"actuallyadditions.networking.string_to_tile.failed": "Failed to send string to tile entity: %s",
|
||||||
|
"actuallyadditions.networking.number_to_tile.failed": "Failed to send number to tile entity: %s",
|
||||||
|
"actuallyadditions.networking.button_to_container.failed": "Failed to send button press to container: %s",
|
||||||
"_comment": "JEI",
|
"_comment": "JEI",
|
||||||
"jei.actuallyadditions.coffee.special": "Special Feature",
|
"jei.actuallyadditions.coffee.special": "Special Feature",
|
||||||
"jei.actuallyadditions.coffee.maxAmount": "Max Amount",
|
"jei.actuallyadditions.coffee.maxAmount": "Max Amount",
|
||||||
"jei.actuallyadditions.coffee.extra.milk": "+01:00, -1 Level",
|
"jei.actuallyadditions.coffee.extra.milk": "+01:00, -1 Level",
|
||||||
"jei.actuallyadditions.mining_lens": "Lens of the Miner",
|
"jei.actuallyadditions.mining_lens": "Lens of the Miner",
|
||||||
"jei.actuallyadditions.mining_lens.weight": "Weight:",
|
"jei.actuallyadditions.mining_lens.weight": "Weight:",
|
||||||
"container.actuallyadditions.item_tag": "Item Tag"
|
"container.actuallyadditions.item_tag": "Item Tag",
|
||||||
|
|
||||||
|
"key.actualladditions.crafting_stick_open.desc": "Open the Crafting Stick",
|
||||||
|
"key.actuallyadditions.category": "Actually Additions"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# 1.3.5+mc1.21.1
|
||||||
|
* Overhaul networking, should fix a lot of issues with crashes on servers
|
||||||
|
* Add storage block tags for the crystals
|
||||||
|
* Add tags for the different filled buckets
|
||||||
|
* Change the tag used by Rice Slimeballs to `c:slime_balls`
|
||||||
|
|
||||||
# 1.3.4+mc1.21.1
|
# 1.3.4+mc1.21.1
|
||||||
* Fix the way the Atomic Reconstructor handles the level when adding tooltips. Fixes an issue that would cause CM2E to crash
|
* Fix the way the Atomic Reconstructor handles the level when adding tooltips. Fixes an issue that would cause CM2E to crash
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue