From bbdc15b26f35c6dde9e99e351561ae8bf34fe3e4 Mon Sep 17 00:00:00 2001 From: TropheusJ Date: Tue, 20 Jun 2023 00:28:13 -0400 Subject: [PATCH 1/3] make it actually build --- build.gradle.kts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 58957dc5..02ba3d8c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -90,6 +90,8 @@ dependencies { isTransitive = false }) + modLocalRuntime("maven.modrinth:cloth-config:10.0.96+fabric") + include(modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:5.1.0") { exclude(group = "net.fabricmc.fabric-api") exclude(group = "net.fabricmc") @@ -102,7 +104,7 @@ dependencies { // modCompileOnly("com.simibubi.create:create-fabric-1.19.2:0.5.0.i-930+1.19.2") - modCompileOnly("maven.modrinth:visible-barriers:2.0.1") + modCompileOnly("maven.modrinth:visiblebarriers:2.0.1") include(implementation("net.objecthunter:exp4j:0.4.8")!!) From 0626a52e81edd8de86442ac0da8385eb26d2497d Mon Sep 17 00:00:00 2001 From: TropheusJ Date: Tue, 20 Jun 2023 00:28:37 -0400 Subject: [PATCH 2/3] faith plates require a wrench to configure --- .../com/fusionflux/portalcubed/blocks/FaithPlateBlock.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateBlock.java b/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateBlock.java index 92a0190c..08832d4f 100644 --- a/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateBlock.java +++ b/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateBlock.java @@ -1,6 +1,7 @@ package com.fusionflux.portalcubed.blocks; import com.fusionflux.portalcubed.blocks.blockentities.FaithPlateBlockEntity; +import com.fusionflux.portalcubed.items.PortalCubedItems; import com.fusionflux.portalcubed.util.CustomProperties; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -49,7 +50,7 @@ public FaithPlateBlock(Properties settings, Supplier Date: Tue, 20 Jun 2023 02:55:02 -0400 Subject: [PATCH 3/3] refactor prop destruction and loot now requires hammer, now featuring datagen --- build.gradle.kts | 18 +++++ .../fa38d5b522e7a4d75b0fa9f0e2387c7cdb9ea73e | 26 +++++++ .../loot_tables/entities/adventure_core.json | 21 +++++ .../loot_tables/entities/anger_core.json | 21 +++++ .../loot_tables/entities/beans.json | 21 +++++ .../loot_tables/entities/chair.json | 21 +++++ .../loot_tables/entities/companion_cube.json | 21 +++++ .../loot_tables/entities/computer.json | 21 +++++ .../loot_tables/entities/core_frame.json | 21 +++++ .../loot_tables/entities/curiosity_core.json | 21 +++++ .../loot_tables/entities/energy_pellet.json | 21 +++++ .../loot_tables/entities/fact_core.json | 21 +++++ .../loot_tables/entities/hoopy.json | 21 +++++ .../entities/intelligence_core.json | 21 +++++ .../portalcubed/loot_tables/entities/jug.json | 21 +++++ .../loot_tables/entities/lil_pineapple.json | 21 +++++ .../loot_tables/entities/morality_core.json | 21 +++++ .../portalcubed/loot_tables/entities/mug.json | 21 +++++ .../loot_tables/entities/old_ap_cube.json | 21 +++++ .../entities/portal_1_companion_cube.json | 21 +++++ .../entities/portal_1_storage_cube.json | 21 +++++ .../loot_tables/entities/radio.json | 21 +++++ .../entities/redirection_cube.json | 21 +++++ .../entities/schrodinger_cube.json | 21 +++++ .../loot_tables/entities/space_core.json | 21 +++++ .../loot_tables/entities/storage_cube.json | 21 +++++ .../loot_tables/entities/turret.json | 21 +++++ .../render/entity/CorePhysicsRenderer.java | 5 ++ .../portalcubed/data/PortalCubedDatagen.java | 11 +++ .../data/PortalCubedEntityLoot.java | 77 +++++++++++++++++++ .../portalcubed/entity/CorePhysicsEntity.java | 48 ++++++------ src/main/resources/quilt.mod.json | 3 +- 32 files changed, 690 insertions(+), 23 deletions(-) create mode 100644 src/generated/resources/.cache/fa38d5b522e7a4d75b0fa9f0e2387c7cdb9ea73e create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/adventure_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/anger_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/beans.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/chair.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/companion_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/computer.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/core_frame.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/curiosity_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/energy_pellet.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/fact_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/hoopy.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/intelligence_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/jug.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/lil_pineapple.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/morality_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/mug.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/old_ap_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_companion_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_storage_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/radio.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/redirection_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/schrodinger_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/space_core.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/storage_cube.json create mode 100644 src/generated/resources/data/portalcubed/loot_tables/entities/turret.json create mode 100644 src/main/java/com/fusionflux/portalcubed/data/PortalCubedDatagen.java create mode 100644 src/main/java/com/fusionflux/portalcubed/data/PortalCubedEntityLoot.java diff --git a/build.gradle.kts b/build.gradle.kts index 02ba3d8c..ea25fd51 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -125,6 +125,24 @@ dependencies { loom { accessWidenerPath.set(file("src/main/resources/portalcubed.accesswidener")) + runs { + create("datagen") { + client() + name("Data Generation") + vmArg("-Dfabric-api.datagen") + vmArg("-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}") + vmArg("-Dfabric-api.datagen.modid=portalcubed") + } + } +} + +sourceSets { + main { + resources { + srcDir("src/generated/resources") + exclude("src/generated/resources/.cache") + } + } } checkstyle { diff --git a/src/generated/resources/.cache/fa38d5b522e7a4d75b0fa9f0e2387c7cdb9ea73e b/src/generated/resources/.cache/fa38d5b522e7a4d75b0fa9f0e2387c7cdb9ea73e new file mode 100644 index 00000000..b197a84b --- /dev/null +++ b/src/generated/resources/.cache/fa38d5b522e7a4d75b0fa9f0e2387c7cdb9ea73e @@ -0,0 +1,26 @@ +// 1.19.4 2023-06-20T02:18:16.635105 Portal Cubed/minecraft:entity Loot Table +86318041d1ac315fabfc88090d936e86682580c3 data\portalcubed\loot_tables\entities\jug.json +b6b91f589e96c00755552126be8649b5ba0f2aeb data\portalcubed\loot_tables\entities\space_core.json +fd2fc0a38a7350cb98dd9a515cc4616df5f298c8 data\portalcubed\loot_tables\entities\beans.json +9a319d32af74012091ff2ebeb7dfc4cc2900c217 data\portalcubed\loot_tables\entities\old_ap_cube.json +8ec3addaf3236aa2d33881c96dc45bf44984046d data\portalcubed\loot_tables\entities\portal_1_storage_cube.json +fb9d054a28d17044419f7497f273490cd284471b data\portalcubed\loot_tables\entities\mug.json +d973ae191dc2028412755414dfd96a6e0f8757a3 data\portalcubed\loot_tables\entities\portal_1_companion_cube.json +dbe4700abb769c9c200dbfb1a78fec63430eaa79 data\portalcubed\loot_tables\entities\storage_cube.json +b3f1f2fbb9c918c62d4e5f6930670c5920b2c690 data\portalcubed\loot_tables\entities\radio.json +57a5e0bf2373e2548dab8077543b9e95e8dd2ad4 data\portalcubed\loot_tables\entities\intelligence_core.json +19cd9ae3c2937208bfa9390163854ab38472f3ef data\portalcubed\loot_tables\entities\curiosity_core.json +df05785c45716c8c5e5ce5f3466f0cfabd94076c data\portalcubed\loot_tables\entities\core_frame.json +d4762018abff4512768063591fcf4c671ed72911 data\portalcubed\loot_tables\entities\companion_cube.json +05125e0bb26b7431648dd726813673f6aeb174ab data\portalcubed\loot_tables\entities\energy_pellet.json +3def4866fc047758973a2fed3167b59e5e847d20 data\portalcubed\loot_tables\entities\computer.json +8bf3757e35e8778cc4939cfa7cd07ea470de86d7 data\portalcubed\loot_tables\entities\chair.json +540b3dca3c773a9a73b065daac0a49f61d8c3142 data\portalcubed\loot_tables\entities\fact_core.json +78f8faf928fd5249f9c3a1c62769d40ae6ddf669 data\portalcubed\loot_tables\entities\hoopy.json +4029f6e0a7b46fcb4d25b368bc35379bc6efa36a data\portalcubed\loot_tables\entities\schrodinger_cube.json +f34b72ab48c4137c06c5808efd74ac57b1d16641 data\portalcubed\loot_tables\entities\morality_core.json +40d721cea2d04fde3163f010b62edf39821f5538 data\portalcubed\loot_tables\entities\adventure_core.json +d933164c6894e055c25653b6571096682b4864ac data\portalcubed\loot_tables\entities\lil_pineapple.json +00a9a37c5ac20598fa218d93792ed75fb53edc33 data\portalcubed\loot_tables\entities\anger_core.json +2033d3dc9a856d5382e84ae4c17785c6e8fdfbde data\portalcubed\loot_tables\entities\redirection_cube.json +ce78046a3d102b0d8813dfa698c0533cec58eb02 data\portalcubed\loot_tables\entities\turret.json diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/adventure_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/adventure_core.json new file mode 100644 index 00000000..5f438591 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/adventure_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:adventure_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/anger_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/anger_core.json new file mode 100644 index 00000000..d4d85834 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/anger_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:anger_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/beans.json b/src/generated/resources/data/portalcubed/loot_tables/entities/beans.json new file mode 100644 index 00000000..05daea2a --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/beans.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:beans" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/chair.json b/src/generated/resources/data/portalcubed/loot_tables/entities/chair.json new file mode 100644 index 00000000..0d2c4a8e --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/chair.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:chair" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/companion_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/companion_cube.json new file mode 100644 index 00000000..13a6bfe3 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/companion_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:companion_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/computer.json b/src/generated/resources/data/portalcubed/loot_tables/entities/computer.json new file mode 100644 index 00000000..16212548 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/computer.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:computer" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/core_frame.json b/src/generated/resources/data/portalcubed/loot_tables/entities/core_frame.json new file mode 100644 index 00000000..d6a2ee5e --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/core_frame.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:core_frame" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/curiosity_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/curiosity_core.json new file mode 100644 index 00000000..7afbb80f --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/curiosity_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:curiosity_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/energy_pellet.json b/src/generated/resources/data/portalcubed/loot_tables/entities/energy_pellet.json new file mode 100644 index 00000000..34e73f2b --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/energy_pellet.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:energy_pellet" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/fact_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/fact_core.json new file mode 100644 index 00000000..dbddf9c2 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/fact_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:fact_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/hoopy.json b/src/generated/resources/data/portalcubed/loot_tables/entities/hoopy.json new file mode 100644 index 00000000..3f953761 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/hoopy.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:hoopy" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/intelligence_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/intelligence_core.json new file mode 100644 index 00000000..d17f60bd --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/intelligence_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:intelligence_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/jug.json b/src/generated/resources/data/portalcubed/loot_tables/entities/jug.json new file mode 100644 index 00000000..d0eeae58 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/jug.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:jug" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/lil_pineapple.json b/src/generated/resources/data/portalcubed/loot_tables/entities/lil_pineapple.json new file mode 100644 index 00000000..0a59eb34 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/lil_pineapple.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:lil_pineapple" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/morality_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/morality_core.json new file mode 100644 index 00000000..583b78d2 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/morality_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:morality_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/mug.json b/src/generated/resources/data/portalcubed/loot_tables/entities/mug.json new file mode 100644 index 00000000..4e2e624e --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/mug.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:mug" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/old_ap_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/old_ap_cube.json new file mode 100644 index 00000000..c14d2233 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/old_ap_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:old_ap_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_companion_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_companion_cube.json new file mode 100644 index 00000000..2ce8f9aa --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_companion_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:portal_1_companion_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_storage_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_storage_cube.json new file mode 100644 index 00000000..e56264ab --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/portal_1_storage_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:portal_1_storage_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/radio.json b/src/generated/resources/data/portalcubed/loot_tables/entities/radio.json new file mode 100644 index 00000000..e8c3b4b9 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/radio.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:radio" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/redirection_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/redirection_cube.json new file mode 100644 index 00000000..e39d6ac2 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/redirection_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:redirection_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/schrodinger_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/schrodinger_cube.json new file mode 100644 index 00000000..fcd36069 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/schrodinger_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:schrodinger_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/space_core.json b/src/generated/resources/data/portalcubed/loot_tables/entities/space_core.json new file mode 100644 index 00000000..ecad98fd --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/space_core.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:space_core" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/storage_cube.json b/src/generated/resources/data/portalcubed/loot_tables/entities/storage_cube.json new file mode 100644 index 00000000..40fe5aba --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/storage_cube.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:storage_cube" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/portalcubed/loot_tables/entities/turret.json b/src/generated/resources/data/portalcubed/loot_tables/entities/turret.json new file mode 100644 index 00000000..5c3759b8 --- /dev/null +++ b/src/generated/resources/data/portalcubed/loot_tables/entities/turret.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "this" + } + ], + "name": "portalcubed:turret" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/main/java/com/fusionflux/portalcubed/client/render/entity/CorePhysicsRenderer.java b/src/main/java/com/fusionflux/portalcubed/client/render/entity/CorePhysicsRenderer.java index d6ebd7fc..8af84dd3 100644 --- a/src/main/java/com/fusionflux/portalcubed/client/render/entity/CorePhysicsRenderer.java +++ b/src/main/java/com/fusionflux/portalcubed/client/render/entity/CorePhysicsRenderer.java @@ -12,6 +12,11 @@ public CorePhysicsRenderer(EntityRendererProvider.Context context, M entityModel super(context, entityModel, f); } + @Override + protected boolean shouldShowName(T entity) { + return entity.isCustomNameVisible() && super.shouldShowName(entity); + } + @Override protected void setupRotations(T entity, PoseStack matrices, float animationProgress, float bodyYaw, float tickDelta) { RayonIntegration.INSTANCE.multiplyMatrices(matrices, entity, tickDelta); diff --git a/src/main/java/com/fusionflux/portalcubed/data/PortalCubedDatagen.java b/src/main/java/com/fusionflux/portalcubed/data/PortalCubedDatagen.java new file mode 100644 index 00000000..1b1ea34b --- /dev/null +++ b/src/main/java/com/fusionflux/portalcubed/data/PortalCubedDatagen.java @@ -0,0 +1,11 @@ +package com.fusionflux.portalcubed.data; + +import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; +import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; + +public class PortalCubedDatagen implements DataGeneratorEntrypoint { + @Override + public void onInitializeDataGenerator(FabricDataGenerator generator) { + generator.createPack().addProvider(PortalCubedEntityLoot::new); + } +} diff --git a/src/main/java/com/fusionflux/portalcubed/data/PortalCubedEntityLoot.java b/src/main/java/com/fusionflux/portalcubed/data/PortalCubedEntityLoot.java new file mode 100644 index 00000000..ca26229f --- /dev/null +++ b/src/main/java/com/fusionflux/portalcubed/data/PortalCubedEntityLoot.java @@ -0,0 +1,77 @@ +package com.fusionflux.portalcubed.data; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.BiConsumer; + +import com.fusionflux.portalcubed.entity.PortalCubedEntities; +import com.fusionflux.portalcubed.items.PortalCubedItems; +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.LootTable.Builder; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.functions.CopyNameFunction; +import net.minecraft.world.level.storage.loot.functions.CopyNameFunction.NameSource; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; + +public class PortalCubedEntityLoot extends SimpleFabricLootTableProvider { + private final Map tables = new HashMap<>(); + + public PortalCubedEntityLoot(FabricDataOutput output) { + super(output, LootContextParamSets.ENTITY); + } + + @Override + public void generate(BiConsumer out) { + buildLootTables(); + tables.forEach(out); + } + + public void buildLootTables() { + keepName(PortalCubedEntities.STORAGE_CUBE, PortalCubedItems.STORAGE_CUBE); + keepName(PortalCubedEntities.COMPANION_CUBE, PortalCubedItems.COMPANION_CUBE); + keepName(PortalCubedEntities.REDIRECTION_CUBE, PortalCubedItems.REDIRECTION_CUBE); + keepName(PortalCubedEntities.SCHRODINGER_CUBE, PortalCubedItems.SCHRODINGER_CUBE); + keepName(PortalCubedEntities.RADIO, PortalCubedItems.RADIO); + keepName(PortalCubedEntities.OLD_AP_CUBE, PortalCubedItems.OLD_AP_CUBE); + keepName(PortalCubedEntities.PORTAL_1_COMPANION_CUBE, PortalCubedItems.PORTAL_1_COMPANION_CUBE); + keepName(PortalCubedEntities.PORTAL_1_STORAGE_CUBE, PortalCubedItems.PORTAL_1_STORAGE_CUBE); + keepName(PortalCubedEntities.BEANS, PortalCubedItems.BEANS); + keepName(PortalCubedEntities.MUG, PortalCubedItems.MUG); + keepName(PortalCubedEntities.JUG, PortalCubedItems.JUG); + keepName(PortalCubedEntities.COMPUTER, PortalCubedItems.COMPUTER); + keepName(PortalCubedEntities.CHAIR, PortalCubedItems.CHAIR); + keepName(PortalCubedEntities.LIL_PINEAPPLE, PortalCubedItems.LIL_PINEAPPLE); + keepName(PortalCubedEntities.HOOPY, PortalCubedItems.HOOPY); + keepName(PortalCubedEntities.CORE_FRAME, PortalCubedItems.CORE_FRAME); + keepName(PortalCubedEntities.ANGER_CORE, PortalCubedItems.ANGER_CORE); + keepName(PortalCubedEntities.MORALITY_CORE, PortalCubedItems.MORALITY_CORE); + keepName(PortalCubedEntities.CAKE_CORE, PortalCubedItems.CAKE_CORE); + keepName(PortalCubedEntities.CURIOSITY_CORE, PortalCubedItems.CURIOSITY_CORE); + keepName(PortalCubedEntities.SPACE_CORE, PortalCubedItems.SPACE_CORE); + keepName(PortalCubedEntities.FACT_CORE, PortalCubedItems.FACT_CORE); + keepName(PortalCubedEntities.ADVENTURE_CORE, PortalCubedItems.ADVENTURE_CORE); + keepName(PortalCubedEntities.ENERGY_PELLET, PortalCubedItems.ENERGY_PELLET); + keepName(PortalCubedEntities.TURRET, PortalCubedItems.TURRET); + } + + public void add(EntityType type, Builder builder) { + tables.put(type.getDefaultLootTable(), builder); + } + + public void keepName(EntityType type, ItemLike item) { + add(type, LootTable.lootTable() + .withPool(LootPool.lootPool() + .add(LootItem.lootTableItem(item) + .apply(CopyNameFunction.copyName(NameSource.THIS)) + ) + ) + ); + } +} diff --git a/src/main/java/com/fusionflux/portalcubed/entity/CorePhysicsEntity.java b/src/main/java/com/fusionflux/portalcubed/entity/CorePhysicsEntity.java index 0175c608..35cf7ca7 100644 --- a/src/main/java/com/fusionflux/portalcubed/entity/CorePhysicsEntity.java +++ b/src/main/java/com/fusionflux/portalcubed/entity/CorePhysicsEntity.java @@ -7,6 +7,7 @@ import com.fusionflux.portalcubed.blocks.PortalCubedBlocks; import com.fusionflux.portalcubed.client.packet.PortalCubedClientPackets; import com.fusionflux.portalcubed.compat.rayon.RayonIntegration; +import com.fusionflux.portalcubed.items.PortalCubedItems; import com.fusionflux.portalcubed.sound.PortalCubedSounds; import com.fusionflux.portalcubed.util.AdvancedEntityRaycast; import com.fusionflux.portalcubed.util.PortalCubedComponents; @@ -14,6 +15,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket; @@ -24,18 +26,19 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ClipContext; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; import org.quiltmc.qsl.networking.api.PacketByteBufs; import org.quiltmc.qsl.networking.api.PlayerLookup; @@ -82,29 +85,20 @@ public boolean isPushable() { } @Override - public boolean isInvulnerableTo(DamageSource damageSource) { - return damageSource != damageSources().outOfWorld() && !damageSource.isCreativePlayer(); + public boolean isInvulnerableTo(DamageSource source) { + if (source.isCreativePlayer() || source == damageSources().outOfWorld()) + return false; + if (!(source.getEntity() instanceof Player player)) + return true; + return !player.getItemInHand(InteractionHand.MAIN_HAND).is(PortalCubedItems.HAMMER); } @Override public boolean hurt(DamageSource source, float amount) { - if (!this.level.isClientSide && !this.isRemoved()) { - boolean bl = source.getEntity() instanceof Player && ((Player) source.getEntity()).getAbilities().instabuild; - if (source.getEntity() instanceof Player || source == damageSources().outOfWorld()) { - if (source.getEntity() instanceof Player && ((Player) source.getEntity()).getAbilities().mayBuild) { - if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS) && !bl) { - this.spawnAtLocation(getPickResult()); - } - this.discard(); - } - if (!(source.getEntity() instanceof Player)) { - if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS) && !bl) { - this.spawnAtLocation(getPickResult()); - } - this.discard(); - } - } - + if (!level.isClientSide && !isInvulnerableTo(source) && !isRemoved()) { + dropAllDeathLoot(source); + discard(); + return true; } return false; } @@ -113,15 +107,25 @@ public boolean hurt(DamageSource source, float amount) { public boolean shouldShowName() { return false; } + @Override public boolean isCustomNameVisible() { return false; } + @Override + @NotNull + public Component getDisplayName() { + return super.getDisplayName().plainCopy(); + } + @Nullable @Override - public boolean hasCustomName() { - return false; + public ItemStack getPickResult() { + ItemStack stack = super.getPickResult(); + if (stack != null) + stack.setHoverName(getDisplayName()); + return stack; } @Override diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json index ec63e049..d606aba0 100644 --- a/src/main/resources/quilt.mod.json +++ b/src/main/resources/quilt.mod.json @@ -10,7 +10,8 @@ "client_init": "com.fusionflux.portalcubed.client.PortalCubedClient", "modmenu": "com.fusionflux.portalcubed.compat.ModMenuIntegration", "cardinal-components": "com.fusionflux.portalcubed.util.PortalCubedComponents", - "dynamiclights": "com.fusionflux.portalcubed.compat.LambDynamicLightsIntegration" + "dynamiclights": "com.fusionflux.portalcubed.compat.LambDynamicLightsIntegration", + "fabric-datagen": "com.fusionflux.portalcubed.data.PortalCubedDatagen" }, "depends": [