mirror of
https://github.com/RoBaertschi/EnvironmentTech.git
synced 2025-04-19 23:03:28 +00:00
Compare commits
No commits in common. "1.21.x" and "0.1" have entirely different histories.
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
@ -44,7 +44,7 @@ jobs:
|
|||||||
run: ./gradlew publish -ProbaertschiPassword=${{ secrets.REPOSILITE_SECRET }} -ProbaertschiUsername=${{ secrets.REPOSILITE_NAME }}
|
run: ./gradlew publish -ProbaertschiPassword=${{ secrets.REPOSILITE_SECRET }} -ProbaertschiUsername=${{ secrets.REPOSILITE_NAME }}
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Artifacts
|
name: Artifacts
|
||||||
path: build/libs
|
path: build/libs
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get Version
|
- name: Get Version
|
||||||
id: mod_version
|
id: mod_version
|
||||||
run: echo "mod_version=""$(./gradlew printVersion | grep -E ^[0-9]+\.[0-9]+ -m 1)" >> "$GITHUB_OUTPUT"
|
run: echo "mod_version=""$(./gradlew printVersion | grep -E ^[0-9]+\.[0-9]+ -m 1)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Minecraft Version
|
- name: Minecraft Version
|
||||||
id: minecraft_version
|
id: minecraft_version
|
||||||
|
17
COPYING
17
COPYING
@ -6,12 +6,11 @@ Some code might have a different license, if this is true, then there will be a
|
|||||||
Other Licenses:
|
Other Licenses:
|
||||||
- src
|
- src
|
||||||
- main
|
- main
|
||||||
- xyz
|
- robaertschi
|
||||||
- robaertschi
|
- environmenttech
|
||||||
- environmenttech
|
- client
|
||||||
- client
|
- renderer
|
||||||
- renderer
|
- EnvStorageRenderer.java = Blu's License of Common Sense
|
||||||
- EnvStorageRenderer.java = Blu's License of Common Sense
|
- RenderUtils.java = LGPL-3.0
|
||||||
- RenderUtils.java = LGPL-3.0
|
- utils
|
||||||
- utils
|
- MouseUtils.java = MIT
|
||||||
- MouseUtils.java = MIT
|
|
||||||
|
@ -2,16 +2,13 @@ import java.net.URI
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
|
eclipse
|
||||||
idea
|
idea
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("io.freefair.lombok") version "8.6"
|
id("io.freefair.lombok") version "8.6"
|
||||||
|
id ("net.neoforged.gradle.userdev") version ("7.0.152")
|
||||||
id("com.diffplug.spotless") version "7.0.0.BETA1"
|
id("com.diffplug.spotless") version "7.0.0.BETA1"
|
||||||
id("com.palantir.git-version") version "3.1.0"
|
id("com.palantir.git-version") version "3.1.0"
|
||||||
id ("net.neoforged.gradle.userdev") version ("7.0.171")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<Wrapper>("wrapper") {
|
|
||||||
distributionType = Wrapper.DistributionType.BIN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val minecraftVersion: String by project
|
val minecraftVersion: String by project
|
||||||
@ -43,14 +40,15 @@ enum class RecipeViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val withTop = true
|
val withTop = true
|
||||||
val recipeViewer: RecipeViewer = RecipeViewer.JEI
|
val recipeViewer: RecipeViewer = RecipeViewer.EMI
|
||||||
|
|
||||||
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
|
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
|
||||||
val details = versionDetails()
|
val details = versionDetails()
|
||||||
|
|
||||||
val snapshot = "-SNAPSHOT"
|
val snapshot = "-SNAPSHOT"
|
||||||
|
val subversion = ".${details.commitDistance}"
|
||||||
val noTag = !details.lastTag.contains(Regex("""\d+\.\d+"""))
|
val noTag = !details.lastTag.contains(Regex("""\d+\.\d+"""))
|
||||||
val end = if (noTag) snapshot else ".${details.commitDistance}${snapshot}"
|
val end = if (noTag) snapshot else "${details.commitDistance}${snapshot}"
|
||||||
|
|
||||||
val modVersion: String = "${details.lastTag}${if (details.commitDistance > 0 || noTag) end else ""}"
|
val modVersion: String = "${details.lastTag}${if (details.commitDistance > 0 || noTag) end else ""}"
|
||||||
val release = details.commitDistance == 0 && !noTag
|
val release = details.commitDistance == 0 && !noTag
|
||||||
@ -105,11 +103,11 @@ spotless {
|
|||||||
java {
|
java {
|
||||||
// Originally, this was from Kaupenjoe's repo, and was licensed by BluSunrize as the original code was from her, so we exclude it to not add our License Header
|
// Originally, this was from Kaupenjoe's repo, and was licensed by BluSunrize as the original code was from her, so we exclude it to not add our License Header
|
||||||
targetExclude(
|
targetExclude(
|
||||||
"src/main/java/xyz/robaertschi/environmenttech/client/renderer/EnvStorageRenderer.java",
|
"src/main/java/robaertschi/environmenttech/client/renderer/EnvStorageRenderer.java",
|
||||||
"src/main/java/xyz/robaertschi/environmenttech/utils/MouseUtils.java",
|
"src/main/java/robaertschi/environmenttech/utils/MouseUtils.java",
|
||||||
"src/main/java/xyz/robaertschi/environmenttech/client/RenderUtils.java"
|
"src/main/java/robaertschi/environmenttech/client/RenderUtils.java"
|
||||||
)
|
)
|
||||||
importOrder("lombok", "java|javax", "", "net.minecraft", "com.mojang", "xyz.robaertschi", "\\#")
|
importOrder("lombok", "java|javax", "", "net.minecraft", "com.mojang", "robaertschi", "\\#")
|
||||||
removeUnusedImports()
|
removeUnusedImports()
|
||||||
licenseHeaderFile("HEADER.java")
|
licenseHeaderFile("HEADER.java")
|
||||||
}
|
}
|
||||||
@ -181,8 +179,7 @@ runs {
|
|||||||
|
|
||||||
create("server") {
|
create("server") {
|
||||||
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
||||||
|
programArgument ("--nogui")
|
||||||
argument("--nogui")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||||
@ -190,6 +187,7 @@ runs {
|
|||||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||||
create("gameTestServer") {
|
create("gameTestServer") {
|
||||||
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,7 +196,7 @@ runs {
|
|||||||
// workingDirectory project.file("run-data")
|
// workingDirectory project.file("run-data")
|
||||||
|
|
||||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||||
arguments.addAll ("--mod", modId, "--all", "--output", file("src/generated/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath)
|
programArguments.addAll ("--mod", modId, "--all", "--output", file("src/generated/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,20 +6,20 @@ org.gradle.debug=false
|
|||||||
## Environment Properties
|
## Environment Properties
|
||||||
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||||
# The Minecraft version must agree with the Neo version to get a valid artifact
|
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||||
minecraftVersion=1.21.1
|
minecraftVersion=1.21.0
|
||||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||||
# as they do not follow standard versioning conventions.
|
# as they do not follow standard versioning conventions.
|
||||||
minecraftVersionRange=[1.21.1,1.22)
|
minecraftVersionRange=[1.21.0,1.22)
|
||||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||||
neoVersion=21.1.84
|
neoVersion=21.0.42-beta
|
||||||
# The Neo version range can use any version of Neo as bounds
|
# The Neo version range can use any version of Neo as bounds
|
||||||
neoVersionRange=[21,)
|
neoVersionRange=[21,)
|
||||||
# The loader version range can only use the major version of FML as bounds
|
# The loader version range can only use the major version of FML as bounds
|
||||||
loaderVersionRange=[2,)
|
loaderVersionRange=[2,)
|
||||||
|
|
||||||
neogradle.subsystems.parchment.minecraftVersion=1.21.1
|
neogradle.subsystems.parchment.minecraftVersion=1.21
|
||||||
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
|
neogradle.subsystems.parchment.mappingsVersion=2024.06.23
|
||||||
|
|
||||||
## Mod Properties
|
## Mod Properties
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ modDescription=
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
junitVersion=5.10.2
|
junitVersion=5.10.2
|
||||||
assertjVersion=3.25.1
|
assertjVersion=3.25.1
|
||||||
topVersion=1.21_neo-12.0.4-6
|
topVersion=1.21_neo-12.0.0-1
|
||||||
reiVersion=16.0.729
|
reiVersion=16.0.729
|
||||||
jeiVersion=19.9.1.125
|
jeiVersion=19.0.0.11
|
||||||
jeiMcVersion=1.21.1
|
jeiMcVersion=1.21
|
||||||
emiVersion=1.1.18+1.21.1
|
emiVersion=1.1.8+1.21
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
7
gradlew
vendored
Executable file → Normal file
7
gradlew
vendored
Executable file → Normal file
@ -15,8 +15,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@ -57,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@ -86,8 +84,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
' "$PWD" ) || exit
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -13,8 +13,6 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
@rem SPDX-License-Identifier: Apache-2.0
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 1.21.1 2024-12-09T14:59:53.785896902 Item Models: environmenttech
|
// 1.21 2024-06-28T21:07:33.627257498 Item Models: environmenttech
|
||||||
ee3837b261f3dbe2001ba1192716f0fdf144b663 assets/environmenttech/models/item/env_collector.json
|
ee3837b261f3dbe2001ba1192716f0fdf144b663 assets/environmenttech/models/item/env_collector.json
|
||||||
719f96ed0245a9dc7c32294d66055e76fc594e30 assets/environmenttech/models/item/env_detector.json
|
719f96ed0245a9dc7c32294d66055e76fc594e30 assets/environmenttech/models/item/env_detector.json
|
||||||
e6d7f80a803863d6196f53d67487af2b3644323b assets/environmenttech/models/item/env_detector_0.json
|
e6d7f80a803863d6196f53d67487af2b3644323b assets/environmenttech/models/item/env_detector_0.json
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// 1.21.1 2024-12-09T14:59:53.785039397 Block States: environmenttech
|
// 1.21 2024-06-26T15:38:42.326642 Block States: environmenttech
|
||||||
6abc8b83d4fb4316ca2dbb977510e6f349ef9e9c assets/environmenttech/blockstates/env_collector.json
|
6abc8b83d4fb4316ca2dbb977510e6f349ef9e9c assets/environmenttech/blockstates/env_collector.json
|
||||||
f7e8f32de50650930080d0d5d1a24176774d4bb9 assets/environmenttech/blockstates/env_distributor.json
|
f7e8f32de50650930080d0d5d1a24176774d4bb9 assets/environmenttech/blockstates/env_distributor.json
|
||||||
bfdfed4f43d4013b3429cbd38800952e96e9b3cb assets/environmenttech/blockstates/heat_generator.json
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 1.21.1 2024-12-09T14:59:53.785699933 Recipes
|
// 1.21 2024-07-02T20:26:53.286412918 Recipes
|
||||||
375ee3cb8eaf222bd0d5576061d1741b5b3d5cff data/environmenttech/advancement/recipes/environmental_essence.json
|
375ee3cb8eaf222bd0d5576061d1741b5b3d5cff data/environmenttech/advancement/recipes/environmental_essence.json
|
||||||
99b83974e5a7a570c2111cab62a292d126c36524 data/environmenttech/advancement/recipes/misc/env_collector_block_item.json
|
99b83974e5a7a570c2111cab62a292d126c36524 data/environmenttech/advancement/recipes/misc/env_collector_block_item.json
|
||||||
810a3e2750c6fe259d203216b1e5046e49e345d6 data/environmenttech/advancement/recipes/misc/env_distributor_block_item.json
|
810a3e2750c6fe259d203216b1e5046e49e345d6 data/environmenttech/advancement/recipes/misc/env_distributor_block_item.json
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"facing=east": {
|
|
||||||
"model": "environmenttech:block/heat_generator",
|
|
||||||
"y": 90
|
|
||||||
},
|
|
||||||
"facing=north": {
|
|
||||||
"model": "environmenttech:block/heat_generator"
|
|
||||||
},
|
|
||||||
"facing=south": {
|
|
||||||
"model": "environmenttech:block/heat_generator",
|
|
||||||
"y": 180
|
|
||||||
},
|
|
||||||
"facing=west": {
|
|
||||||
"model": "environmenttech:block/heat_generator",
|
|
||||||
"y": 270
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.unittest;
|
package robaertschi.environmenttech.unittest;
|
||||||
|
|
||||||
|
|
||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
@ -14,11 +14,11 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.unittest;
|
package robaertschi.environmenttech.unittest;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.client.screen.ProgressArrowUtils;
|
import robaertschi.environmenttech.client.screen.ProgressArrowUtils;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
|
@ -14,14 +14,14 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech;
|
package robaertschi.environmenttech;
|
||||||
|
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||||
|
|
||||||
import static xyz.robaertschi.environmenttech.ET.MODID;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
|
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
|
||||||
// Demonstrates how to use Neo's config APIs
|
// Demonstrates how to use Neo's config APIs
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech;
|
package robaertschi.environmenttech;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech;
|
package robaertschi.environmenttech;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
@ -27,21 +27,21 @@ import org.slf4j.Logger;
|
|||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.command.EnvironmenttechCommand;
|
import robaertschi.environmenttech.command.EnvironmenttechCommand;
|
||||||
import xyz.robaertschi.environmenttech.compat.ETCompat;
|
import robaertschi.environmenttech.compat.ETCompat;
|
||||||
import xyz.robaertschi.environmenttech.data.attachments.ETAttachments;
|
import robaertschi.environmenttech.data.attachments.ETAttachments;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.ETCapabilities;
|
import robaertschi.environmenttech.data.capabilities.ETCapabilities;
|
||||||
import xyz.robaertschi.environmenttech.data.components.ETComponents;
|
import robaertschi.environmenttech.data.components.ETComponents;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.ETRecipes;
|
import robaertschi.environmenttech.data.recipes.ETRecipes;
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
import robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
||||||
import xyz.robaertschi.environmenttech.level.fluid.ETFluidTypes;
|
import robaertschi.environmenttech.level.fluid.ETFluidTypes;
|
||||||
import xyz.robaertschi.environmenttech.level.fluid.ETFluids;
|
import robaertschi.environmenttech.level.fluid.ETFluids;
|
||||||
import xyz.robaertschi.environmenttech.level.item.ETItems;
|
import robaertschi.environmenttech.level.item.ETItems;
|
||||||
import xyz.robaertschi.environmenttech.level.particle.ETParticles;
|
import robaertschi.environmenttech.level.particle.ETParticles;
|
||||||
import xyz.robaertschi.environmenttech.menu.ETMenus;
|
import robaertschi.environmenttech.menu.ETMenus;
|
||||||
|
|
||||||
import static xyz.robaertschi.environmenttech.ET.MODID;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
@Mod(MODID)
|
@Mod(MODID)
|
@ -14,9 +14,8 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.client;
|
package robaertschi.environmenttech.client;
|
||||||
|
|
||||||
import net.neoforged.api.distmarker.Dist;
|
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
@ -24,19 +23,19 @@ import net.neoforged.neoforge.client.event.*;
|
|||||||
|
|
||||||
import net.minecraft.client.renderer.item.ItemProperties;
|
import net.minecraft.client.renderer.item.ItemProperties;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.client.particle.EnvParticleProvider;
|
import robaertschi.environmenttech.client.particle.EnvParticleProvider;
|
||||||
import xyz.robaertschi.environmenttech.client.screen.EnvCollectorScreen;
|
import robaertschi.environmenttech.client.screen.EnvCollectorScreen;
|
||||||
import xyz.robaertschi.environmenttech.data.components.ETComponents;
|
import robaertschi.environmenttech.data.components.ETComponents;
|
||||||
import xyz.robaertschi.environmenttech.data.components.FilledComponent;
|
import robaertschi.environmenttech.data.components.FilledComponent;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
import robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.renderer.EnvCollectorRenderer;
|
import robaertschi.environmenttech.level.block.entity.renderer.EnvCollectorRenderer;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.renderer.EnvDistributorRenderer;
|
import robaertschi.environmenttech.level.block.entity.renderer.EnvDistributorRenderer;
|
||||||
import xyz.robaertschi.environmenttech.level.item.ETItems;
|
import robaertschi.environmenttech.level.item.ETItems;
|
||||||
import xyz.robaertschi.environmenttech.level.particle.ETParticles;
|
import robaertschi.environmenttech.level.particle.ETParticles;
|
||||||
import xyz.robaertschi.environmenttech.menu.ETMenus;
|
import robaertschi.environmenttech.menu.ETMenus;
|
||||||
|
|
||||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, modid = ET.MODID, value = Dist.CLIENT)
|
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||||
public class ETClient {
|
public class ETClient {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
@ -1,4 +1,4 @@
|
|||||||
package xyz.robaertschi.environmenttech.client;
|
package robaertschi.environmenttech.client;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.client.particle;
|
package robaertschi.environmenttech.client.particle;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ import net.minecraft.client.particle.ParticleProvider;
|
|||||||
import net.minecraft.client.particle.SpriteSet;
|
import net.minecraft.client.particle.SpriteSet;
|
||||||
import net.minecraft.core.particles.SimpleParticleType;
|
import net.minecraft.core.particles.SimpleParticleType;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.particle.EnvParticle;
|
import robaertschi.environmenttech.level.particle.EnvParticle;
|
||||||
|
|
||||||
@AllArgsConstructor()
|
@AllArgsConstructor()
|
||||||
public class EnvParticleProvider implements ParticleProvider<SimpleParticleType> {
|
public class EnvParticleProvider implements ParticleProvider<SimpleParticleType> {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.client.renderer;
|
package robaertschi.environmenttech.client.renderer;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package xyz.robaertschi.environmenttech.client.renderer;
|
package robaertschi.environmenttech.client.renderer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -8,8 +8,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
|||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.util.FastColor;
|
import net.minecraft.util.FastColor;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.IEnvStorage;
|
import robaertschi.environmenttech.data.capabilities.IEnvStorage;
|
||||||
import xyz.robaertschi.environmenttech.utils.MouseUtils;
|
import robaertschi.environmenttech.utils.MouseUtils;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BluSunrize
|
* BluSunrize
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.client.screen;
|
package robaertschi.environmenttech.client.screen;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -24,9 +24,9 @@ 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;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
import robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
||||||
import xyz.robaertschi.environmenttech.menu.EnvCollectorMenu;
|
import robaertschi.environmenttech.menu.EnvCollectorMenu;
|
||||||
|
|
||||||
public class EnvCollectorScreen extends AbstractContainerScreen<EnvCollectorMenu> {
|
public class EnvCollectorScreen extends AbstractContainerScreen<EnvCollectorMenu> {
|
||||||
public static final ResourceLocation GUI = ET.id("textures/gui/container/env_collector.png");
|
public static final ResourceLocation GUI = ET.id("textures/gui/container/env_collector.png");
|
@ -14,11 +14,11 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.client.screen;
|
package robaertschi.environmenttech.client.screen;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
|
|
||||||
public class ProgressArrowUtils {
|
public class ProgressArrowUtils {
|
||||||
public static final ResourceLocation SPRITE = ET.id("textures/gui/sprites/component/progress_arrow.png");
|
public static final ResourceLocation SPRITE = ET.id("textures/gui/sprites/component/progress_arrow.png");
|
@ -14,14 +14,13 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.command;
|
package robaertschi.environmenttech.command;
|
||||||
|
|
||||||
import net.neoforged.neoforge.server.command.EnumArgument;
|
import net.neoforged.neoforge.server.command.EnumArgument;
|
||||||
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
|
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
|
||||||
import net.minecraft.commands.arguments.coordinates.WorldCoordinates;
|
import net.minecraft.commands.arguments.coordinates.WorldCoordinates;
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@ -30,14 +29,13 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
|||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.arguments.LongArgumentType;
|
import com.mojang.brigadier.arguments.LongArgumentType;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.data.attachments.ETAttachments;
|
import robaertschi.environmenttech.data.attachments.ETAttachments;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.ETCapabilities;
|
import robaertschi.environmenttech.data.capabilities.ETCapabilities;
|
||||||
|
import robaertschi.environmenttech.data.capabilities.EnvType;
|
||||||
|
|
||||||
import static net.minecraft.commands.Commands.*;
|
import static net.minecraft.commands.Commands.*;
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
|
||||||
public class EnvironmenttechCommand {
|
public class EnvironmenttechCommand {
|
||||||
|
|
||||||
public EnvironmenttechCommand(CommandDispatcher<CommandSourceStack> dispatcher) {
|
public EnvironmenttechCommand(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
dispatcher.register(
|
dispatcher.register(
|
||||||
literal("environmenttech")
|
literal("environmenttech")
|
||||||
@ -66,33 +64,19 @@ public class EnvironmenttechCommand {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}))
|
}))
|
||||||
.then(literal("set_env").then(argument("pos", BlockPosArgument.blockPos()).then(argument("amount", LongArgumentType.longArg(0)).executes(
|
.then(literal("set_env").then(argument("pos", BlockPosArgument.blockPos()).then(argument("env_type", EnumArgument.enumArgument(EnvType.class)).then(argument("amount", LongArgumentType.longArg(0)).executes(
|
||||||
context -> {
|
context -> {
|
||||||
WorldCoordinates pos = context.getArgument("pos", WorldCoordinates.class);
|
WorldCoordinates pos = context.getArgument("pos", WorldCoordinates.class);
|
||||||
|
EnvType type = context.getArgument("env_type", EnvType.class);
|
||||||
long amount = context.getArgument("amount", Long.class);
|
long amount = context.getArgument("amount", Long.class);
|
||||||
|
var cap = context.getSource().getPlayerOrException().level().getCapability(ETCapabilities.ENV_STORAGE_BLOCK, pos.getBlockPos(context.getSource()), type);
|
||||||
var cap = context.getSource().getPlayerOrException().level().getCapability(ETCapabilities.ENV_STORAGE_BLOCK, pos.getBlockPos(context.getSource()));
|
|
||||||
if (cap != null) {
|
if (cap != null) {
|
||||||
cap.receiveEnv(amount, false);
|
cap.receiveEnv(amount, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
)).then(literal("set_bundled_env").then(argument("pos", BlockPosArgument.blockPos()).then(argument("direction", EnumArgument.enumArgument(Direction.class)).then(argument("amount", LongArgumentType.longArg(0)).executes(
|
)))))
|
||||||
context -> {
|
|
||||||
WorldCoordinates pos = context.getArgument("pos", WorldCoordinates.class);
|
|
||||||
long amount = context.getArgument("amount", Long.class);
|
|
||||||
Direction direction = context.getArgument("direction", Direction.class);
|
|
||||||
|
|
||||||
var cap = context.getSource().getPlayerOrException().level().getCapability(ETCapabilities.ENV_BUNDLED_STORAGE_BLOCK, pos.getBlockPos(context.getSource()), direction);
|
|
||||||
if (cap != null) {
|
|
||||||
cap.receiveEnv(amount, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
)))))
|
|
||||||
))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,12 +14,12 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat;
|
package robaertschi.environmenttech.compat;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.fml.ModList;
|
import net.neoforged.fml.ModList;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.compat.top.TopCompat;
|
import robaertschi.environmenttech.compat.top.TopCompat;
|
||||||
|
|
||||||
public class ETCompat {
|
public class ETCompat {
|
||||||
public static void init(IEventBus modEventBus) {
|
public static void init(IEventBus modEventBus) {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.emi;
|
package robaertschi.environmenttech.compat.emi;
|
||||||
|
|
||||||
import dev.emi.emi.api.EmiEntrypoint;
|
import dev.emi.emi.api.EmiEntrypoint;
|
||||||
import dev.emi.emi.api.EmiPlugin;
|
import dev.emi.emi.api.EmiPlugin;
|
||||||
@ -27,11 +27,11 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
import net.minecraft.world.item.crafting.RecipeManager;
|
import net.minecraft.world.item.crafting.RecipeManager;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.ETRecipes;
|
import robaertschi.environmenttech.data.recipes.ETRecipes;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
import robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
||||||
import xyz.robaertschi.environmenttech.level.item.ETItems;
|
import robaertschi.environmenttech.level.item.ETItems;
|
||||||
import xyz.robaertschi.environmenttech.menu.ETMenus;
|
import robaertschi.environmenttech.menu.ETMenus;
|
||||||
|
|
||||||
@EmiEntrypoint
|
@EmiEntrypoint
|
||||||
public class EmiCompatPlugin implements EmiPlugin {
|
public class EmiCompatPlugin implements EmiPlugin {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.emi;
|
package robaertschi.environmenttech.compat.emi;
|
||||||
|
|
||||||
import dev.emi.emi.api.recipe.BasicEmiRecipe;
|
import dev.emi.emi.api.recipe.BasicEmiRecipe;
|
||||||
import dev.emi.emi.api.render.EmiTexture;
|
import dev.emi.emi.api.render.EmiTexture;
|
||||||
@ -24,8 +24,8 @@ import dev.emi.emi.api.widget.WidgetHolder;
|
|||||||
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
import robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
import robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
||||||
|
|
||||||
public class EnvCollectorEmiRecipe extends BasicEmiRecipe {
|
public class EnvCollectorEmiRecipe extends BasicEmiRecipe {
|
||||||
private final EnvCollectorRecipe recipe;
|
private final EnvCollectorRecipe recipe;
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.emi;
|
package robaertschi.environmenttech.compat.emi;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ import org.apache.commons.compress.utils.Lists;
|
|||||||
|
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.menu.EnvCollectorMenu;
|
import robaertschi.environmenttech.menu.EnvCollectorMenu;
|
||||||
|
|
||||||
public class EnvCollectorEmiRecipeHandler implements StandardRecipeHandler<EnvCollectorMenu> {
|
public class EnvCollectorEmiRecipeHandler implements StandardRecipeHandler<EnvCollectorMenu> {
|
||||||
@Override
|
@Override
|
@ -14,12 +14,13 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.jei;
|
package robaertschi.environmenttech.compat.jei;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||||
import mezz.jei.api.gui.builder.ITooltipBuilder;
|
|
||||||
import mezz.jei.api.gui.drawable.IDrawable;
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
||||||
import mezz.jei.api.helpers.IGuiHelper;
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
@ -35,12 +36,12 @@ import net.minecraft.util.Mth;
|
|||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
import robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
||||||
import xyz.robaertschi.environmenttech.client.screen.EnvCollectorScreen;
|
import robaertschi.environmenttech.client.screen.EnvCollectorScreen;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.ETRecipes;
|
import robaertschi.environmenttech.data.recipes.ETRecipes;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
import robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.utils.MouseUtils;
|
import robaertschi.environmenttech.utils.MouseUtils;
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
@ -78,8 +79,11 @@ public class EnvCollectorRecipeCategory implements IRecipeCategory<RecipeHolder<
|
|||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder<EnvCollectorRecipe> recipeHolder, IFocusGroup focuses) {
|
public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder<EnvCollectorRecipe> recipeHolder, IFocusGroup focuses) {
|
||||||
EnvCollectorRecipe recipe = recipeHolder.value();
|
EnvCollectorRecipe recipe = recipeHolder.value();
|
||||||
|
|
||||||
builder.addSlot(RecipeIngredientRole.INPUT, 6, 16).addIngredients(recipe.input());
|
builder.addSlot(RecipeIngredientRole.INPUT, 6, 16).addIngredients(recipe.input());
|
||||||
|
|
||||||
builder.addSlot(RecipeIngredientRole.OUTPUT, 68, 17).addItemStack(recipe.output());
|
builder.addSlot(RecipeIngredientRole.OUTPUT, 68, 17).addItemStack(recipe.output());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -89,11 +93,15 @@ public class EnvCollectorRecipeCategory implements IRecipeCategory<RecipeHolder<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getTooltip(ITooltipBuilder builder, RecipeHolder<EnvCollectorRecipe> recipe, IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) {
|
public List<Component> getTooltipStrings(RecipeHolder<EnvCollectorRecipe> recipe, IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) {
|
||||||
|
List<Component> components = new ArrayList<>();
|
||||||
|
|
||||||
int x = getWidth() - 10;
|
int x = getWidth() - 10;
|
||||||
if (MouseUtils.isMouseOver(Mth.floor(mouseX), Mth.floor(mouseY), x, 2, 8, 45)) {
|
if (MouseUtils.isMouseOver(Mth.floor(mouseX), Mth.floor(mouseY), x, 2, 8, 45)) {
|
||||||
builder.add(Component.literal(recipe.value().envUsed() + " / " + 64 + " ENV"));
|
components.add(Component.literal(recipe.value().envUsed() + " / " + 64 + " ENV"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return components;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.jei;
|
package robaertschi.environmenttech.compat.jei;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
@ -32,11 +32,12 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.ETRecipes;
|
import robaertschi.environmenttech.data.recipes.ETRecipes;
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.menu.ETMenus;
|
import robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
||||||
import xyz.robaertschi.environmenttech.menu.EnvCollectorMenu;
|
import robaertschi.environmenttech.menu.ETMenus;
|
||||||
|
import robaertschi.environmenttech.menu.EnvCollectorMenu;
|
||||||
|
|
||||||
@JeiPlugin
|
@JeiPlugin
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
@ -54,6 +55,7 @@ public class JeiCompatPlugin implements IModPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipes(IRecipeRegistration registration) {
|
public void registerRecipes(IRecipeRegistration registration) {
|
||||||
|
|
||||||
assert Minecraft.getInstance().level != null;
|
assert Minecraft.getInstance().level != null;
|
||||||
registration.addRecipes(EnvCollectorRecipeCategory.ENV_COLLECTOR, Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(ETRecipes.ENV_COLLECTOR_RECIPE_TYPE.get()).stream().toList());
|
registration.addRecipes(EnvCollectorRecipeCategory.ENV_COLLECTOR, Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(ETRecipes.ENV_COLLECTOR_RECIPE_TYPE.get()).stream().toList());
|
||||||
}
|
}
|
||||||
@ -66,9 +68,9 @@ public class JeiCompatPlugin implements IModPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void registerRecipeTransferHandlers(IRecipeTransferRegistration registration) {
|
public void registerRecipeTransferHandlers(IRecipeTransferRegistration registration) {
|
||||||
registration.addRecipeTransferHandler(EnvCollectorMenu.class, ETMenus.ENV_COLLECTOR_MENU.get(), EnvCollectorRecipeCategory.ENV_COLLECTOR,
|
registration.addRecipeTransferHandler(EnvCollectorMenu.class, ETMenus.ENV_COLLECTOR_MENU.get(), EnvCollectorRecipeCategory.ENV_COLLECTOR,
|
||||||
0,
|
EnvCollectorBlockEntity.SLOT_INPUT,
|
||||||
1,
|
EnvCollectorBlockEntity.SLOT_INPUT_COUNT,
|
||||||
2,
|
EnvCollectorBlockEntity.SLOT_COUNT,
|
||||||
Inventory.INVENTORY_SIZE);
|
Inventory.INVENTORY_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.top;
|
package robaertschi.environmenttech.compat.top;
|
||||||
|
|
||||||
import mcjty.theoneprobe.api.IProbeHitData;
|
import mcjty.theoneprobe.api.IProbeHitData;
|
||||||
import mcjty.theoneprobe.api.IProbeInfo;
|
import mcjty.theoneprobe.api.IProbeInfo;
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.compat.top;
|
package robaertschi.environmenttech.compat.top;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@ -24,19 +24,18 @@ import net.neoforged.fml.InterModComms;
|
|||||||
import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent;
|
import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent;
|
||||||
import net.neoforged.neoforge.capabilities.BlockCapabilityCache;
|
import net.neoforged.neoforge.capabilities.BlockCapabilityCache;
|
||||||
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.EnvironmentTech;
|
import robaertschi.environmenttech.EnvironmentTech;
|
||||||
import xyz.robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
import robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.ETCapabilities;
|
import robaertschi.environmenttech.data.capabilities.ETCapabilities;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.IBundledEnvStorage;
|
import robaertschi.environmenttech.data.capabilities.EnvType;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.IEnvStorage;
|
import robaertschi.environmenttech.data.capabilities.IEnvStorage;
|
||||||
|
|
||||||
public class TopCompat {
|
public class TopCompat {
|
||||||
public static void init(IEventBus modEventBus) {
|
public static void init(IEventBus modEventBus) {
|
||||||
@ -55,8 +54,7 @@ public class TopCompat {
|
|||||||
probe = theOneProbe;
|
probe = theOneProbe;
|
||||||
EnvironmentTech.LOGGER.info("Enabled TheOneProbe support");
|
EnvironmentTech.LOGGER.info("Enabled TheOneProbe support");
|
||||||
theOneProbe.registerProvider(new IProbeInfoProvider() {
|
theOneProbe.registerProvider(new IProbeInfoProvider() {
|
||||||
private BlockCapabilityCache<IEnvStorage, Void> capCache = null;
|
private BlockCapabilityCache<IEnvStorage, EnvType> capCache = null;
|
||||||
private BlockCapabilityCache<IBundledEnvStorage, Direction> bundledCapCache = null;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getID() {
|
public ResourceLocation getID() {
|
||||||
@ -73,11 +71,14 @@ public class TopCompat {
|
|||||||
if (!(level instanceof ServerLevel)) return;
|
if (!(level instanceof ServerLevel)) return;
|
||||||
|
|
||||||
if (capCache == null || !capCache.pos().equals(iProbeHitData.getPos())) {
|
if (capCache == null || !capCache.pos().equals(iProbeHitData.getPos())) {
|
||||||
capCache = BlockCapabilityCache.create(ETCapabilities.ENV_STORAGE_BLOCK, (ServerLevel) level, iProbeHitData.getPos(), null);
|
capCache = BlockCapabilityCache.create(ETCapabilities.ENV_STORAGE_BLOCK, (ServerLevel) level, iProbeHitData.getPos(), EnvType.Normal);
|
||||||
}
|
// Try other env types
|
||||||
// Try other env types
|
if (capCache.getCapability() == null) {
|
||||||
if (bundledCapCache == null || !capCache.pos().equals(iProbeHitData.getPos())) {
|
capCache = BlockCapabilityCache.create(ETCapabilities.ENV_STORAGE_BLOCK, (ServerLevel) level, iProbeHitData.getPos(), EnvType.Bundled);
|
||||||
bundledCapCache = BlockCapabilityCache.create(ETCapabilities.ENV_BUNDLED_STORAGE_BLOCK, (ServerLevel) level, iProbeHitData.getPos(), null);
|
}
|
||||||
|
if (capCache.getCapability() == null) {
|
||||||
|
capCache = BlockCapabilityCache.create(ETCapabilities.ENV_STORAGE_BLOCK, (ServerLevel) level, iProbeHitData.getPos(), EnvType.Chunk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnvStorage cap = capCache.getCapability();
|
IEnvStorage cap = capCache.getCapability();
|
||||||
@ -88,15 +89,6 @@ public class TopCompat {
|
|||||||
.suffix(" ENV");
|
.suffix(" ENV");
|
||||||
iProbeInfo.horizontal().progress(cap.getEnvStored(),cap.getMaxEnv(), style);
|
iProbeInfo.horizontal().progress(cap.getEnvStored(),cap.getMaxEnv(), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
IBundledEnvStorage bundledCap = bundledCapCache.getCapability();
|
|
||||||
if (bundledCap != null) {
|
|
||||||
var style = iProbeInfo.defaultProgressStyle()
|
|
||||||
.filledColor(EnvStorageRenderer.from)
|
|
||||||
.alternateFilledColor(EnvStorageRenderer.to)
|
|
||||||
.suffix(" Bundled ENV");
|
|
||||||
iProbeInfo.horizontal().progress(bundledCap.getEnvStored(), bundledCap.getMaxEnv(), style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.attachments;
|
package robaertschi.environmenttech.data.attachments;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ -25,11 +25,10 @@ import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
|||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
public class ETAttachments {
|
public class ETAttachments {
|
||||||
private static final DeferredRegister<AttachmentType<?>> ATTACHMENT_TYPES = DeferredRegister.create(NeoForgeRegistries.ATTACHMENT_TYPES, ET.MODID);
|
private static final DeferredRegister<AttachmentType<?>> ATTACHMENT_TYPES = DeferredRegister.create(NeoForgeRegistries.ATTACHMENT_TYPES, MODID);
|
||||||
|
|
||||||
public static final Supplier<AttachmentType<Long>> ENV = ATTACHMENT_TYPES.register(
|
public static final Supplier<AttachmentType<Long>> ENV = ATTACHMENT_TYPES.register(
|
||||||
"env", () -> AttachmentType.builder(() -> 0L).serialize(Codec.LONG).build()
|
"env", () -> AttachmentType.builder(() -> 0L).serialize(Codec.LONG).build()
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.capabilities;
|
package robaertschi.environmenttech.data.capabilities;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.capabilities;
|
package robaertschi.environmenttech.data.capabilities;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.capabilities.BlockCapability;
|
import net.neoforged.neoforge.capabilities.BlockCapability;
|
||||||
@ -23,17 +23,15 @@ import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
|
|||||||
|
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
import robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
||||||
|
|
||||||
public class ETCapabilities {
|
public class ETCapabilities {
|
||||||
public static final BlockCapability<IEnvStorage, Void> ENV_STORAGE_BLOCK =
|
public static final BlockCapability<IEnvStorage, EnvType> ENV_STORAGE_BLOCK =
|
||||||
BlockCapability.createVoid(ET.id("env_storage"),
|
BlockCapability.create(ET.id("env_storage"),
|
||||||
IEnvStorage.class);
|
IEnvStorage.class,
|
||||||
|
EnvType.class
|
||||||
public static final BlockCapability<IBundledEnvStorage, Direction> ENV_BUNDLED_STORAGE_BLOCK =
|
);
|
||||||
BlockCapability.create(ET.id("env_bundled_storage"),
|
|
||||||
IBundledEnvStorage.class, Direction.class);
|
|
||||||
|
|
||||||
public static void init(IEventBus iEventBus) {
|
public static void init(IEventBus iEventBus) {
|
||||||
iEventBus.addListener(ETCapabilities::registerCapabilities);
|
iEventBus.addListener(ETCapabilities::registerCapabilities);
|
||||||
@ -57,13 +55,19 @@ public class ETCapabilities {
|
|||||||
event.registerBlockEntity(
|
event.registerBlockEntity(
|
||||||
ENV_STORAGE_BLOCK,
|
ENV_STORAGE_BLOCK,
|
||||||
ETBlockEntities.ENV_COLLECTOR_BLOCK_ENTITY.get(),
|
ETBlockEntities.ENV_COLLECTOR_BLOCK_ENTITY.get(),
|
||||||
(object, context) -> object.getEnvStorage()
|
(object, context) -> {
|
||||||
|
if (context == EnvType.Chunk) return object.getEnvStorage();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
event.registerBlockEntity(
|
event.registerBlockEntity(
|
||||||
ENV_STORAGE_BLOCK,
|
ENV_STORAGE_BLOCK,
|
||||||
ETBlockEntities.ENV_DISTRIBUTOR_BLOCK_ENTITY.get(),
|
ETBlockEntities.ENV_DISTRIBUTOR_BLOCK_ENTITY.get(),
|
||||||
(object, context) -> object.getEnvStorage()
|
(object, context) -> {
|
||||||
|
if (context == EnvType.Chunk) return object.getEnvStorage();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -14,26 +14,40 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.capabilities;
|
package robaertschi.environmenttech.data.capabilities;
|
||||||
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class EnvStorage implements IEnvStorage {
|
public class EnvStorage implements IEnvStorage {
|
||||||
|
private final EnvType[] acceptedEnvTypes;
|
||||||
private final long maxEnv;
|
private final long maxEnv;
|
||||||
private long env;
|
private long env;
|
||||||
private final long maxTransfer;
|
private final long maxTransfer;
|
||||||
|
|
||||||
public EnvStorage(long maxEnv) {
|
public EnvStorage(EnvType acceptedEnvType, long maxEnv, long env, long maxTransfer) {
|
||||||
this(maxEnv, 0, maxEnv);
|
this.acceptedEnvTypes = new EnvType[1];
|
||||||
}
|
this.acceptedEnvTypes[0] = acceptedEnvType;
|
||||||
|
|
||||||
public EnvStorage(long maxEnv, long env, long maxTransfer) {
|
|
||||||
this.maxEnv = maxEnv;
|
this.maxEnv = maxEnv;
|
||||||
this.env = env;
|
this.env = env;
|
||||||
this.maxTransfer = maxTransfer;
|
this.maxTransfer = maxTransfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EnvStorage(EnvType acceptedEnvType, long maxEnv) {
|
||||||
|
this(acceptedEnvType, maxEnv, 0, maxEnv);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnvStorage(EnvType[] acceptedEnvTypes, long maxEnv, long env, long maxTransfer) {
|
||||||
|
this.acceptedEnvTypes = acceptedEnvTypes;
|
||||||
|
this.maxEnv = maxEnv;
|
||||||
|
this.env = env;
|
||||||
|
this.maxTransfer = maxTransfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnvStorage(EnvType[] acceptedEnvTypes, long maxEnv) {
|
||||||
|
this(acceptedEnvTypes, maxEnv, 0, maxEnv);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long receiveEnv(long amount, boolean simulate) {
|
public long receiveEnv(long amount, boolean simulate) {
|
||||||
long received = Mth.clamp(this.maxEnv - this.env, 0, Math.min(amount, maxTransfer));
|
long received = Mth.clamp(this.maxEnv - this.env, 0, Math.min(amount, maxTransfer));
|
||||||
@ -59,5 +73,10 @@ public class EnvStorage implements IEnvStorage {
|
|||||||
return maxEnv;
|
return maxEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnvType[] canAcceptEnvType() {
|
||||||
|
return acceptedEnvTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public void onContentsChanged() {}
|
public void onContentsChanged() {}
|
||||||
}
|
}
|
@ -14,21 +14,10 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.menu;
|
package robaertschi.environmenttech.data.capabilities;
|
||||||
|
|
||||||
import net.neoforged.neoforge.items.IItemHandler;
|
public enum EnvType {
|
||||||
import net.neoforged.neoforge.items.SlotItemHandler;
|
Chunk,
|
||||||
import org.jetbrains.annotations.NotNull;
|
Normal,
|
||||||
|
Bundled,
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
|
|
||||||
public class ModifiableSlotItemHandler extends SlotItemHandler {
|
|
||||||
public ModifiableSlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition) {
|
|
||||||
super(itemHandler, index, xPosition, yPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean allowModification(@NotNull Player player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.capabilities;
|
package robaertschi.environmenttech.data.capabilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ENV is pushed based, so you should not be able to extract ENV from anything.
|
* ENV is pushed based, so you should not be able to extract ENV from anything.
|
||||||
@ -32,4 +32,10 @@ public interface IEnvStorage {
|
|||||||
|
|
||||||
long getEnvStored();
|
long getEnvStored();
|
||||||
long getMaxEnv();
|
long getMaxEnv();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Which ENVType's that are supported.
|
||||||
|
*/
|
||||||
|
EnvType[] canAcceptEnvType();
|
||||||
}
|
}
|
@ -14,20 +14,18 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.components;
|
package robaertschi.environmenttech.data.components;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
|
|
||||||
import net.minecraft.core.component.DataComponentType;
|
import net.minecraft.core.component.DataComponentType;
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
|
||||||
|
|
||||||
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
public class ETComponents {
|
public class ETComponents {
|
||||||
public static final DeferredRegister.DataComponents DATA_COMPONENTS = DeferredRegister.createDataComponents(Registries.DATA_COMPONENT_TYPE, ET.MODID);
|
public static final DeferredRegister.DataComponents DATA_COMPONENTS = DeferredRegister.createDataComponents(MODID);
|
||||||
|
|
||||||
public static final DeferredHolder<DataComponentType<?>, DataComponentType<FilledComponent>> FILLED_COMPONENT = DATA_COMPONENTS.registerComponentType("filled_component",
|
public static final DeferredHolder<DataComponentType<?>, DataComponentType<FilledComponent>> FILLED_COMPONENT = DATA_COMPONENTS.registerComponentType("filled_component",
|
||||||
filledComponentBuilder -> filledComponentBuilder.persistent(FilledComponent.CODEC).networkSynchronized(FilledComponent.STREAM_CODEC)
|
filledComponentBuilder -> filledComponentBuilder.persistent(FilledComponent.CODEC).networkSynchronized(FilledComponent.STREAM_CODEC)
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.components;
|
package robaertschi.environmenttech.data.components;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.recipes;
|
package robaertschi.environmenttech.data.recipes;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
@ -24,12 +24,11 @@ import net.minecraft.core.registries.Registries;
|
|||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
public class ETRecipes {
|
public class ETRecipes {
|
||||||
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(Registries.RECIPE_TYPE, ET.MODID);
|
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(Registries.RECIPE_TYPE, MODID);
|
||||||
public static final DeferredRegister<RecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(Registries.RECIPE_SERIALIZER, ET.MODID);
|
public static final DeferredRegister<RecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(Registries.RECIPE_SERIALIZER, MODID);
|
||||||
|
|
||||||
public static final DeferredHolder<RecipeType<?>, RecipeType<EnvCollectorRecipe>> ENV_COLLECTOR_RECIPE_TYPE = RECIPE_TYPES.register("env_collector", RecipeType::simple);
|
public static final DeferredHolder<RecipeType<?>, RecipeType<EnvCollectorRecipe>> ENV_COLLECTOR_RECIPE_TYPE = RECIPE_TYPES.register("env_collector", RecipeType::simple);
|
||||||
public static final DeferredHolder<RecipeSerializer<?>, RecipeSerializer<EnvCollectorRecipe>> ENV_COLLECTOR_RECIPE_SERIALIZER = RECIPE_SERIALIZERS.register("env_collector", EnvCollectorRecipeSerializer::new);
|
public static final DeferredHolder<RecipeSerializer<?>, RecipeSerializer<EnvCollectorRecipe>> ENV_COLLECTOR_RECIPE_SERIALIZER = RECIPE_SERIALIZERS.register("env_collector", EnvCollectorRecipeSerializer::new);
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.recipes;
|
package robaertschi.environmenttech.data.recipes;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.data.recipes;
|
package robaertschi.environmenttech.data.recipes;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.datagen;
|
package robaertschi.environmenttech.datagen;
|
||||||
|
|
||||||
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
|
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
|
||||||
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
||||||
@ -22,9 +22,9 @@ import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
|||||||
|
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
|
|
||||||
import static xyz.robaertschi.environmenttech.ET.MODID;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
public class ETBlockStateProvider extends BlockStateProvider {
|
public class ETBlockStateProvider extends BlockStateProvider {
|
||||||
public ETBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
|
public ETBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
|
||||||
@ -36,6 +36,5 @@ public class ETBlockStateProvider extends BlockStateProvider {
|
|||||||
// registerEnvCollector();
|
// registerEnvCollector();
|
||||||
horizontalBlock(ETBlocks.ENV_COLLECTOR_BLOCK.get(), new ModelFile.UncheckedModelFile(modLoc("block/env_collector")));
|
horizontalBlock(ETBlocks.ENV_COLLECTOR_BLOCK.get(), new ModelFile.UncheckedModelFile(modLoc("block/env_collector")));
|
||||||
horizontalBlock(ETBlocks.ENV_DISTRIBUTOR_BLOCK.get(), new ModelFile.UncheckedModelFile(modLoc("block/env_distributor")));
|
horizontalBlock(ETBlocks.ENV_DISTRIBUTOR_BLOCK.get(), new ModelFile.UncheckedModelFile(modLoc("block/env_distributor")));
|
||||||
horizontalBlock(ETBlocks.HEAT_GENERATOR_BLOCK.get(), new ModelFile.UncheckedModelFile(modLoc("block/heat_generator")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.datagen;
|
package robaertschi.environmenttech.datagen;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@ -27,10 +27,9 @@ import net.minecraft.core.HolderLookup;
|
|||||||
import net.minecraft.data.DataGenerator;
|
import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, modid = MODID)
|
||||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, modid = ET.MODID)
|
|
||||||
public class ETDatagen {
|
public class ETDatagen {
|
||||||
@SubscribeEvent()
|
@SubscribeEvent()
|
||||||
public static void gatherData(GatherDataEvent event) {
|
public static void gatherData(GatherDataEvent event) {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.datagen;
|
package robaertschi.environmenttech.datagen;
|
||||||
|
|
||||||
import net.neoforged.neoforge.client.model.generators.ItemModelBuilder;
|
import net.neoforged.neoforge.client.model.generators.ItemModelBuilder;
|
||||||
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
|
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
|
||||||
@ -24,12 +24,12 @@ import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
|||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.level.item.ETItems;
|
import robaertschi.environmenttech.level.item.ETItems;
|
||||||
import xyz.robaertschi.environmenttech.level.item.EnvDetectorItem;
|
import robaertschi.environmenttech.level.item.EnvDetectorItem;
|
||||||
|
|
||||||
import static xyz.robaertschi.environmenttech.ET.MODID;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
public class ETItemModelProvider extends ItemModelProvider {
|
public class ETItemModelProvider extends ItemModelProvider {
|
||||||
public ETItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) {
|
public ETItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.datagen;
|
package robaertschi.environmenttech.datagen;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@ -33,9 +33,9 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
import robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
||||||
import xyz.robaertschi.environmenttech.level.item.ETItems;
|
import robaertschi.environmenttech.level.item.ETItems;
|
||||||
|
|
||||||
public class ETRecipeProvider extends RecipeProvider {
|
public class ETRecipeProvider extends RecipeProvider {
|
||||||
public ETRecipeProvider(PackOutput pOutput, CompletableFuture<HolderLookup.Provider> pRegistries) {
|
public ETRecipeProvider(PackOutput pOutput, CompletableFuture<HolderLookup.Provider> pRegistries) {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level;
|
package robaertschi.environmenttech.level;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -25,9 +25,9 @@ import net.neoforged.neoforge.event.level.ChunkEvent;
|
|||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.Config;
|
import robaertschi.environmenttech.Config;
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.ET;
|
||||||
import xyz.robaertschi.environmenttech.data.attachments.ETAttachments;
|
import robaertschi.environmenttech.data.attachments.ETAttachments;
|
||||||
|
|
||||||
@EventBusSubscriber(modid = ET.MODID)
|
@EventBusSubscriber(modid = ET.MODID)
|
||||||
@Slf4j(topic = "EnvironmentTech/ChunkData")
|
@Slf4j(topic = "EnvironmentTech/ChunkData")
|
||||||
@ -40,7 +40,7 @@ public class ETChunkEvents {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int random = event.getLevel().getRandom().nextIntBetweenInclusive(Config.minEnvForNewChunk, Config.maxEnvForNewChunk);
|
int random = event.getLevel().getRandom().nextIntBetweenInclusive(Config.minEnvForNewChunk, Config.maxEnvForNewChunk);
|
||||||
// log.debug("New Chunk at pos {}, set random to {}", event.getChunk().getPos(), random);
|
log.debug("New Chunk at pos {}, set random to {}", event.getChunk().getPos(), random);
|
||||||
event.getChunk().setData(ETAttachments.ENV, (long)random);
|
event.getChunk().setData(ETAttachments.ENV, (long)random);
|
||||||
} else if (!event.getChunk().hasData(ETAttachments.ENV)) {
|
} else if (!event.getChunk().hasData(ETAttachments.ENV)) {
|
||||||
int random = event.getLevel().getRandom().nextIntBetweenInclusive(Config.minEnvForNewChunk, Config.maxEnvForNewChunk);
|
int random = event.getLevel().getRandom().nextIntBetweenInclusive(Config.minEnvForNewChunk, Config.maxEnvForNewChunk);
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block;
|
package robaertschi.environmenttech.level.block;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.registries.DeferredBlock;
|
import net.neoforged.neoforge.registries.DeferredBlock;
|
||||||
@ -22,18 +22,15 @@ import net.neoforged.neoforge.registries.DeferredRegister;
|
|||||||
|
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
import xyz.robaertschi.environmenttech.level.block.generators.HeatGeneratorBlock;
|
|
||||||
|
|
||||||
|
|
||||||
public class ETBlocks {
|
public class ETBlocks {
|
||||||
// Create a Deferred Register to hold Blocks which will all be registered under the "environmenttech" namespace
|
// Create a Deferred Register to hold Blocks which will all be registered under the "environmenttech" namespace
|
||||||
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(ET.MODID);
|
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MODID);
|
||||||
// Creates a new Block with the id "environmenttech:example_block", combining the namespace and path
|
// Creates a new Block with the id "environmenttech:example_block", combining the namespace and path
|
||||||
// public static final DeferredBlock<Block> EXAMPLE_BLOCK = BLOCKS.registerSimpleBlock("example_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE));
|
// public static final DeferredBlock<Block> EXAMPLE_BLOCK = BLOCKS.registerSimpleBlock("example_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE));
|
||||||
public static final DeferredBlock<EnvCollectorBlock> ENV_COLLECTOR_BLOCK = BLOCKS.registerBlock("env_collector", EnvCollectorBlock::new, BlockBehaviour.Properties.of());
|
public static final DeferredBlock<EnvCollectorBlock> ENV_COLLECTOR_BLOCK = BLOCKS.registerBlock("env_collector", EnvCollectorBlock::new, BlockBehaviour.Properties.of());
|
||||||
public static final DeferredBlock<EnvDistributorBlock> ENV_DISTRIBUTOR_BLOCK = BLOCKS.registerBlock("env_distributor", EnvDistributorBlock::new, BlockBehaviour.Properties.of());
|
public static final DeferredBlock<EnvDistributorBlock> ENV_DISTRIBUTOR_BLOCK =BLOCKS.registerBlock("env_distributor", EnvDistributorBlock::new, BlockBehaviour.Properties.of());
|
||||||
public static final DeferredBlock<HeatGeneratorBlock> HEAT_GENERATOR_BLOCK = BLOCKS.registerBlock("heat_generator", HeatGeneratorBlock::new, BlockBehaviour.Properties.of());
|
|
||||||
|
|
||||||
|
|
||||||
public static void init(IEventBus iEventBus) {
|
public static void init(IEventBus iEventBus) {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block;
|
package robaertschi.environmenttech.level.block;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -43,8 +43,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||||||
|
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
import robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
import robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault()
|
@ParametersAreNonnullByDefault()
|
||||||
@Slf4j
|
@Slf4j
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block;
|
package robaertschi.environmenttech.level.block;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||||||
|
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
import robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.EnvDistributorBlockEntity;
|
import robaertschi.environmenttech.level.block.entity.EnvDistributorBlockEntity;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block;
|
package robaertschi.environmenttech.level.block;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ import net.minecraft.world.level.block.state.StateDefinition;
|
|||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ITickableBlockEntity;
|
import robaertschi.environmenttech.level.block.entity.ITickableBlockEntity;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity;
|
package robaertschi.environmenttech.level.block.entity;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
@ -23,14 +23,13 @@ import net.neoforged.neoforge.registries.DeferredRegister;
|
|||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.generators.HeatGeneratorBlockEntity;
|
|
||||||
|
|
||||||
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
@SuppressWarnings("DataFlowIssue")
|
@SuppressWarnings("DataFlowIssue")
|
||||||
public class ETBlockEntities {
|
public class ETBlockEntities {
|
||||||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, ET.MODID);
|
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, MODID);
|
||||||
|
|
||||||
@SuppressWarnings("DataFlowIssue")
|
@SuppressWarnings("DataFlowIssue")
|
||||||
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<EnvCollectorBlockEntity>> ENV_COLLECTOR_BLOCK_ENTITY =
|
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<EnvCollectorBlockEntity>> ENV_COLLECTOR_BLOCK_ENTITY =
|
||||||
@ -42,11 +41,6 @@ public class ETBlockEntities {
|
|||||||
BLOCK_ENTITIES.register("env_distributor",
|
BLOCK_ENTITIES.register("env_distributor",
|
||||||
() -> BlockEntityType.Builder.of(EnvDistributorBlockEntity::new, ETBlocks.ENV_DISTRIBUTOR_BLOCK.get()).build(null));
|
() -> BlockEntityType.Builder.of(EnvDistributorBlockEntity::new, ETBlocks.ENV_DISTRIBUTOR_BLOCK.get()).build(null));
|
||||||
|
|
||||||
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<HeatGeneratorBlockEntity>> HEAT_GENERATOR_BLOCK_ENTITY =
|
|
||||||
BLOCK_ENTITIES.register("heat_generator",
|
|
||||||
() -> BlockEntityType.Builder.of(HeatGeneratorBlockEntity::new, ETBlocks.HEAT_GENERATOR_BLOCK.get()).build(null)
|
|
||||||
);
|
|
||||||
|
|
||||||
public static void init(IEventBus iEventBus) {
|
public static void init(IEventBus iEventBus) {
|
||||||
BLOCK_ENTITIES.register(iEventBus);
|
BLOCK_ENTITIES.register(iEventBus);
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity;
|
package robaertschi.environmenttech.level.block.entity;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -50,15 +50,16 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.compat.top.TOPInfoProvider;
|
||||||
import xyz.robaertschi.environmenttech.compat.top.TOPInfoProvider;
|
import robaertschi.environmenttech.data.attachments.ETAttachments;
|
||||||
import xyz.robaertschi.environmenttech.data.attachments.ETAttachments;
|
import robaertschi.environmenttech.data.capabilities.AdaptedItemHandler;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.AdaptedItemHandler;
|
import robaertschi.environmenttech.data.capabilities.EnvStorage;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.EnvStorage;
|
import robaertschi.environmenttech.data.capabilities.EnvType;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.ETRecipes;
|
import robaertschi.environmenttech.data.recipes.ETRecipes;
|
||||||
import xyz.robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
import robaertschi.environmenttech.data.recipes.EnvCollectorRecipe;
|
||||||
import xyz.robaertschi.environmenttech.menu.EnvCollectorMenu;
|
import robaertschi.environmenttech.menu.EnvCollectorMenu;
|
||||||
|
|
||||||
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
public class EnvCollectorBlockEntity extends BlockEntity implements MenuProvider, ITickableBlockEntity, TOPInfoProvider {
|
public class EnvCollectorBlockEntity extends BlockEntity implements MenuProvider, ITickableBlockEntity, TOPInfoProvider {
|
||||||
@ -86,7 +87,7 @@ public class EnvCollectorBlockEntity extends BlockEntity implements MenuProvider
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
@Getter
|
@Getter
|
||||||
private final ItemStackHandler outputInventory = new ItemStackHandler(SLOT_OUTPUT_COUNT) {
|
private final ItemStackHandler outputInventory = new ItemStackHandler(SLOT_INPUT_COUNT) {
|
||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
EnvCollectorBlockEntity.this.setChanged();
|
EnvCollectorBlockEntity.this.setChanged();
|
||||||
assert level != null;
|
assert level != null;
|
||||||
@ -132,7 +133,7 @@ public class EnvCollectorBlockEntity extends BlockEntity implements MenuProvider
|
|||||||
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final EnvStorage envStorage = new EnvStorage(64, 0, 1) {
|
private final EnvStorage envStorage = new EnvStorage(EnvType.Chunk, 64, 0, 1) {
|
||||||
@Override
|
@Override
|
||||||
public void onContentsChanged() {
|
public void onContentsChanged() {
|
||||||
EnvCollectorBlockEntity.this.setChanged();
|
EnvCollectorBlockEntity.this.setChanged();
|
||||||
@ -188,7 +189,7 @@ public class EnvCollectorBlockEntity extends BlockEntity implements MenuProvider
|
|||||||
@Override
|
@Override
|
||||||
protected void loadAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull Provider provider) {
|
protected void loadAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull Provider provider) {
|
||||||
super.loadAdditional(pTag, provider);
|
super.loadAdditional(pTag, provider);
|
||||||
CompoundTag modData = pTag.getCompound(ET.MODID);
|
CompoundTag modData = pTag.getCompound(MODID);
|
||||||
inputInventory.deserializeNBT(provider, modData.getCompound(INPUT_INVENTORY_KEY));
|
inputInventory.deserializeNBT(provider, modData.getCompound(INPUT_INVENTORY_KEY));
|
||||||
outputInventory.deserializeNBT(provider, modData.getCompound(OUTPUT_INVENTORY_KEY));
|
outputInventory.deserializeNBT(provider, modData.getCompound(OUTPUT_INVENTORY_KEY));
|
||||||
this.envStorage.setEnvStored(modData.getLong(ENV_KEY));
|
this.envStorage.setEnvStored(modData.getLong(ENV_KEY));
|
||||||
@ -205,7 +206,7 @@ public class EnvCollectorBlockEntity extends BlockEntity implements MenuProvider
|
|||||||
modData.putLong(ENV_KEY, envStorage.getEnvStored());
|
modData.putLong(ENV_KEY, envStorage.getEnvStored());
|
||||||
modData.putInt(PROGRESS_KEY, progress);
|
modData.putInt(PROGRESS_KEY, progress);
|
||||||
// modData.putInt(MAX_PROGRESS_KEY, maxProgress);
|
// modData.putInt(MAX_PROGRESS_KEY, maxProgress);
|
||||||
pTag.put(ET.MODID, modData);
|
pTag.put(MODID, modData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity;
|
package robaertschi.environmenttech.level.block.entity;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -35,10 +35,11 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.data.attachments.ETAttachments;
|
||||||
import xyz.robaertschi.environmenttech.data.attachments.ETAttachments;
|
import robaertschi.environmenttech.data.capabilities.EnvStorage;
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.EnvStorage;
|
import robaertschi.environmenttech.data.capabilities.EnvType;
|
||||||
|
|
||||||
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
@ -50,7 +51,7 @@ public class EnvDistributorBlockEntity extends BlockEntity implements ITickableB
|
|||||||
private int ticksBetweenProcessTick = 0;
|
private int ticksBetweenProcessTick = 0;
|
||||||
|
|
||||||
public static final String ENV_TAG = "Env";
|
public static final String ENV_TAG = "Env";
|
||||||
private final EnvStorage envStorage = new EnvStorage(64) {
|
private final EnvStorage envStorage = new EnvStorage(EnvType.Chunk, 64) {
|
||||||
@Override
|
@Override
|
||||||
public void onContentsChanged() {
|
public void onContentsChanged() {
|
||||||
EnvDistributorBlockEntity.this.setChanged();
|
EnvDistributorBlockEntity.this.setChanged();
|
||||||
@ -76,7 +77,7 @@ public class EnvDistributorBlockEntity extends BlockEntity implements ITickableB
|
|||||||
@Override
|
@Override
|
||||||
protected void loadAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull Provider pRegistries) {
|
protected void loadAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull Provider pRegistries) {
|
||||||
super.loadAdditional(pTag, pRegistries);
|
super.loadAdditional(pTag, pRegistries);
|
||||||
CompoundTag modData = pTag.getCompound(ET.MODID);
|
CompoundTag modData = pTag.getCompound(MODID);
|
||||||
this.envStorage.setEnvStored(modData.getLong(ENV_TAG));
|
this.envStorage.setEnvStored(modData.getLong(ENV_TAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ public class EnvDistributorBlockEntity extends BlockEntity implements ITickableB
|
|||||||
super.saveAdditional(pTag, pRegistries);
|
super.saveAdditional(pTag, pRegistries);
|
||||||
CompoundTag modData = new CompoundTag();
|
CompoundTag modData = new CompoundTag();
|
||||||
modData.putLong(ENV_TAG, envStorage.getEnvStored());
|
modData.putLong(ENV_TAG, envStorage.getEnvStored());
|
||||||
pTag.put(ET.MODID, modData);
|
pTag.put(MODID, modData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity;
|
package robaertschi.environmenttech.level.block.entity;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity.renderer;
|
package robaertschi.environmenttech.level.block.entity.renderer;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
@ -37,9 +37,9 @@ import net.minecraft.world.phys.Vec3;
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.EnvCollectorBlock;
|
import robaertschi.environmenttech.level.block.EnvCollectorBlock;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
import robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
||||||
import xyz.robaertschi.environmenttech.level.particle.ETParticles;
|
import robaertschi.environmenttech.level.particle.ETParticles;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class EnvCollectorRenderer implements BlockEntityRenderer<EnvCollectorBlockEntity> {
|
public class EnvCollectorRenderer implements BlockEntityRenderer<EnvCollectorBlockEntity> {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity.renderer;
|
package robaertschi.environmenttech.level.block.entity.renderer;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -30,9 +30,9 @@ import net.minecraft.world.phys.Vec3;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.client.RenderUtils;
|
import robaertschi.environmenttech.client.RenderUtils;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.EnvDistributorBlockEntity;
|
import robaertschi.environmenttech.level.block.entity.EnvDistributorBlockEntity;
|
||||||
import xyz.robaertschi.environmenttech.level.fluid.ETFluids;
|
import robaertschi.environmenttech.level.fluid.ETFluids;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
@ -14,58 +14,61 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.fluid;
|
package robaertschi.environmenttech.level.fluid;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||||
import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent;
|
|
||||||
import net.neoforged.neoforge.fluids.FluidType;
|
import net.neoforged.neoforge.fluids.FluidType;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
||||||
import xyz.robaertschi.environmenttech.client.renderer.EnvStorageRenderer;
|
|
||||||
|
|
||||||
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
public class ETFluidTypes {
|
public class ETFluidTypes {
|
||||||
|
|
||||||
public static final ResourceLocation WATER_STILL_RL = ResourceLocation.withDefaultNamespace("block/water_still");
|
public static final ResourceLocation WATER_STILL_RL = ResourceLocation.withDefaultNamespace("block/water_still");
|
||||||
public static final ResourceLocation WATER_FLOWING_RL = ResourceLocation.withDefaultNamespace("block/water_flow");
|
public static final ResourceLocation WATER_FLOWING_RL = ResourceLocation.withDefaultNamespace("block/water_flow");
|
||||||
|
|
||||||
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, ET.MODID);
|
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, MODID);
|
||||||
|
|
||||||
public static final DeferredHolder<FluidType, FluidType> ENV = FLUID_TYPES.register("env",
|
public static final DeferredHolder<FluidType, FluidType> ENV = FLUID_TYPES.register("env",
|
||||||
resourceLocation -> new FluidType(
|
resourceLocation -> new FluidType(
|
||||||
FluidType.Properties.create().density(15).viscosity(5)
|
FluidType.Properties.create().density(15).viscosity(5)
|
||||||
)
|
) {
|
||||||
|
@Override
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
|
||||||
|
consumer.accept(new IClientFluidTypeExtensions() {
|
||||||
|
@Override
|
||||||
|
public int getTintColor() {
|
||||||
|
return EnvStorageRenderer.to;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getFlowingTexture() {
|
||||||
|
return WATER_FLOWING_RL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getStillTexture() {
|
||||||
|
return WATER_STILL_RL;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
public static void registerClientExtensionsEvent(RegisterClientExtensionsEvent event) {
|
|
||||||
event.registerFluidType(new IClientFluidTypeExtensions() {
|
|
||||||
@Override
|
|
||||||
public int getTintColor() {
|
|
||||||
return EnvStorageRenderer.to;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull ResourceLocation getFlowingTexture() {
|
|
||||||
return WATER_FLOWING_RL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull ResourceLocation getStillTexture() {
|
|
||||||
return WATER_STILL_RL;
|
|
||||||
}
|
|
||||||
}, ENV);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init(IEventBus modEventBus) {
|
public static void init(IEventBus modEventBus) {
|
||||||
modEventBus.addListener(ETFluidTypes::registerClientExtensionsEvent);
|
|
||||||
FLUID_TYPES.register(modEventBus);
|
FLUID_TYPES.register(modEventBus);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.fluid;
|
package robaertschi.environmenttech.level.fluid;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.fluids.BaseFlowingFluid;
|
import net.neoforged.neoforge.fluids.BaseFlowingFluid;
|
||||||
@ -24,12 +24,11 @@ import net.neoforged.neoforge.registries.DeferredRegister;
|
|||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
public class ETFluids {
|
public class ETFluids {
|
||||||
|
|
||||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(BuiltInRegistries.FLUID, ET.MODID);
|
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(BuiltInRegistries.FLUID, MODID);
|
||||||
|
|
||||||
|
|
||||||
public static final DeferredHolder<Fluid, Fluid> ENV_FLOWING = FLUIDS.register("env_flowing", resourceLocation -> new BaseFlowingFluid.Flowing(ETFluids.ENV_PROPERTIES));
|
public static final DeferredHolder<Fluid, Fluid> ENV_FLOWING = FLUIDS.register("env_flowing", resourceLocation -> new BaseFlowingFluid.Flowing(ETFluids.ENV_PROPERTIES));
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.item;
|
package robaertschi.environmenttech.level.item;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
@ -30,15 +30,15 @@ import net.minecraft.world.item.CreativeModeTabs;
|
|||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.component.CustomModelData;
|
import net.minecraft.world.item.component.CustomModelData;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
|
||||||
|
|
||||||
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
public class ETItems {
|
public class ETItems {
|
||||||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(ET.MODID);
|
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID);
|
||||||
|
|
||||||
|
|
||||||
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, ET.MODID);
|
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
|
||||||
|
|
||||||
|
|
||||||
// public static final DeferredItem<BlockItem> EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK);
|
// public static final DeferredItem<BlockItem> EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK);
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.item;
|
package robaertschi.environmenttech.level.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
@ -33,9 +33,9 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
import net.minecraft.world.item.TooltipFlag;
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.data.attachments.ETAttachments;
|
import robaertschi.environmenttech.data.attachments.ETAttachments;
|
||||||
import xyz.robaertschi.environmenttech.data.components.ETComponents;
|
import robaertschi.environmenttech.data.components.ETComponents;
|
||||||
import xyz.robaertschi.environmenttech.data.components.FilledComponent;
|
import robaertschi.environmenttech.data.components.FilledComponent;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class EnvDetectorItem extends Item {
|
public class EnvDetectorItem extends Item {
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.particle;
|
package robaertschi.environmenttech.level.particle;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
@ -24,11 +24,10 @@ import net.minecraft.core.particles.ParticleType;
|
|||||||
import net.minecraft.core.particles.SimpleParticleType;
|
import net.minecraft.core.particles.SimpleParticleType;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
public class ETParticles {
|
public class ETParticles {
|
||||||
public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(BuiltInRegistries.PARTICLE_TYPE, ET.MODID);
|
public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(BuiltInRegistries.PARTICLE_TYPE, MODID);
|
||||||
|
|
||||||
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> ENV_PARTICLE = PARTICLES.register("env_particle",
|
public static final DeferredHolder<ParticleType<?>, SimpleParticleType> ENV_PARTICLE = PARTICLES.register("env_particle",
|
||||||
() -> new SimpleParticleType(false)
|
() -> new SimpleParticleType(false)
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.level.particle;
|
package robaertschi.environmenttech.level.particle;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.menu;
|
package robaertschi.environmenttech.menu;
|
||||||
|
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
|
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
|
||||||
@ -24,11 +24,10 @@ import net.neoforged.neoforge.registries.DeferredRegister;
|
|||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.inventory.MenuType;
|
import net.minecraft.world.inventory.MenuType;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
import static robaertschi.environmenttech.ET.MODID;
|
||||||
|
|
||||||
|
|
||||||
public class ETMenus {
|
public class ETMenus {
|
||||||
public static final DeferredRegister<MenuType<?>> MENUS = DeferredRegister.create(BuiltInRegistries.MENU, ET.MODID);
|
public static final DeferredRegister<MenuType<?>> MENUS = DeferredRegister.create(BuiltInRegistries.MENU, MODID);
|
||||||
|
|
||||||
public static final DeferredHolder<MenuType<?>, MenuType<EnvCollectorMenu>> ENV_COLLECTOR_MENU = MENUS.register("env_collector", () ->
|
public static final DeferredHolder<MenuType<?>, MenuType<EnvCollectorMenu>> ENV_COLLECTOR_MENU = MENUS.register("env_collector", () ->
|
||||||
IMenuTypeExtension.create((windowId, inv, data) -> new EnvCollectorMenu(windowId, inv.player, data)));
|
IMenuTypeExtension.create((windowId, inv, data) -> new EnvCollectorMenu(windowId, inv.player, data)));
|
@ -14,7 +14,7 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package xyz.robaertschi.environmenttech.menu;
|
package robaertschi.environmenttech.menu;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -28,12 +28,13 @@ import net.minecraft.world.entity.player.Player;
|
|||||||
import net.minecraft.world.inventory.*;
|
import net.minecraft.world.inventory.*;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.ETBlocks;
|
import robaertschi.environmenttech.level.block.ETBlocks;
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
import robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity;
|
||||||
|
|
||||||
import static xyz.robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity.*;
|
import static robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity.SLOT_COUNT;
|
||||||
|
import static robaertschi.environmenttech.level.block.entity.EnvCollectorBlockEntity.SLOT_INPUT;
|
||||||
|
|
||||||
@SuppressWarnings("ALL")
|
@SuppressWarnings("SameParameterValue")
|
||||||
public class EnvCollectorMenu extends AbstractContainerMenu {
|
public class EnvCollectorMenu extends AbstractContainerMenu {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -48,12 +49,13 @@ public class EnvCollectorMenu extends AbstractContainerMenu {
|
|||||||
super(ETMenus.ENV_COLLECTOR_MENU.get(), pContainerId);
|
super(ETMenus.ENV_COLLECTOR_MENU.get(), pContainerId);
|
||||||
this.blockEntity = blockEntity;
|
this.blockEntity = blockEntity;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
addSlot(new ModifiableSlotItemHandler(blockEntity.getInventory().get(), 0, 54, 34));
|
addSlot(new SlotItemHandler(blockEntity.getInputInventory(), 0, 54, 34));
|
||||||
addSlot(new SlotItemHandler(blockEntity.getInventory().get(), 1, 116, 35));
|
addSlot(new SlotItemHandler(blockEntity.getOutputInventory(), 0, 116, 35));
|
||||||
|
|
||||||
|
|
||||||
layoutPlayerInventorySlots(player.getInventory(), 8, 84);
|
layoutPlayerInventorySlots(player.getInventory(), 8, 84);
|
||||||
|
|
||||||
|
|
||||||
addDataSlots(data);
|
addDataSlots(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ public class EnvCollectorMenu extends AbstractContainerMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.moveItemStackTo(stack, SLOT_INPUT, SLOT_INPUT_COUNT, false)) {
|
if (!this.moveItemStackTo(stack, SLOT_INPUT, SLOT_INPUT+1, false)) {
|
||||||
if (pIndex < 27 + SLOT_COUNT) {
|
if (pIndex < 27 + SLOT_COUNT) {
|
||||||
if (!this.moveItemStackTo(stack, 27 + SLOT_COUNT, 36 + SLOT_COUNT, false)) {
|
if (!this.moveItemStackTo(stack, 27 + SLOT_COUNT, 36 + SLOT_COUNT, false)) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
@ -1,4 +1,4 @@
|
|||||||
package xyz.robaertschi.environmenttech.utils;
|
package robaertschi.environmenttech.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is from <a href="https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/">here</a>.
|
* This file is from <a href="https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/">here</a>.
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* EnvironmentTech MC Mod
|
|
||||||
Copyright (C) 2024 Robin Bärtschi and Contributors
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, by version 3 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package xyz.robaertschi.environmenttech.data.capabilities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ENV is pushed based, so you should not be able to extract ENV from anything.
|
|
||||||
* This is the reason for the nonexistent extract method.
|
|
||||||
* This is currently the same as {@link IEnvStorage}. This will however change sometime. Also they are not the same.
|
|
||||||
* Bundled Env Storage is per Cable, which has a {@link net.minecraft.core.Direction} while the Normal Storage doesn't.
|
|
||||||
*/
|
|
||||||
public interface IBundledEnvStorage {
|
|
||||||
/**
|
|
||||||
* Receive ENV.
|
|
||||||
* @param amount The Amount of ENV to receive.
|
|
||||||
* @param simulate If the operation is to only be simulated and not affect the storage amount
|
|
||||||
* @return How much energy was accepted.
|
|
||||||
*/
|
|
||||||
long receiveEnv(long amount, boolean simulate);
|
|
||||||
|
|
||||||
long getEnvStored();
|
|
||||||
long getMaxEnv();
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* EnvironmentTech MC Mod
|
|
||||||
Copyright (C) 2024 Robin Bärtschi and Contributors
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, by version 3 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package xyz.robaertschi.environmenttech.level.block.entity.generators;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.HolderLookup;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.Blocks;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.ET;
|
|
||||||
import xyz.robaertschi.environmenttech.data.capabilities.EnvStorage;
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ITickableBlockEntity;
|
|
||||||
|
|
||||||
public class HeatGeneratorBlockEntity extends BlockEntity implements ITickableBlockEntity {
|
|
||||||
private static final HashMap<Block, Long> BLOCK_TO_ENV = new HashMap<>(Map.of(Blocks.TORCH, 1L, Blocks.FIRE, 3L, Blocks.CAMPFIRE, 5L, Blocks.SOUL_TORCH, 6L, Blocks.SOUL_FIRE, 8L, Blocks.SOUL_CAMPFIRE, 10L, Blocks.LAVA, 14L));
|
|
||||||
|
|
||||||
public static final String ENV_TAG = "Env";
|
|
||||||
private final EnvStorage envStorage = new EnvStorage(64) {
|
|
||||||
@Override
|
|
||||||
public void onContentsChanged() {
|
|
||||||
HeatGeneratorBlockEntity.this.setChanged();
|
|
||||||
assert level != null;
|
|
||||||
if (!level.isClientSide()) {
|
|
||||||
level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), Block.UPDATE_ALL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setEnvStored(long env) {
|
|
||||||
super.setEnvStored(env);
|
|
||||||
if (level != null && !level.isClientSide()) {
|
|
||||||
level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), Block.UPDATE_ALL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public HeatGeneratorBlockEntity(BlockPos pos, BlockState blockState) {
|
|
||||||
super(ETBlockEntities.HEAT_GENERATOR_BLOCK_ENTITY.get(), pos, blockState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serverTick(ServerLevel level, BlockPos blockPos, BlockState blockState) {
|
|
||||||
var toAdd = BLOCK_TO_ENV.getOrDefault(level.getBlockState(blockPos.below()).getBlock(), 0L);
|
|
||||||
envStorage.receiveEnv(toAdd, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void loadAdditional(@NotNull CompoundTag tag, HolderLookup.@NotNull Provider registries) {
|
|
||||||
super.loadAdditional(tag, registries);
|
|
||||||
CompoundTag modData = tag.getCompound(ET.MODID);
|
|
||||||
this.envStorage.setEnvStored(modData.getLong(ENV_TAG));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void saveAdditional(@NotNull CompoundTag tag, HolderLookup.@NotNull Provider registries) {
|
|
||||||
super.saveAdditional(tag, registries);
|
|
||||||
CompoundTag modData = new CompoundTag();
|
|
||||||
modData.putLong(ENV_TAG, envStorage.getEnvStored());
|
|
||||||
tag.put(ET.MODID, modData);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* EnvironmentTech MC Mod
|
|
||||||
Copyright (C) 2024 Robin Bärtschi and Contributors
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, by version 3 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package xyz.robaertschi.environmenttech.level.block.generators;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
|
|
||||||
import com.mojang.serialization.MapCodec;
|
|
||||||
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.SimpleBlockWithEntity;
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.ETBlockEntities;
|
|
||||||
import xyz.robaertschi.environmenttech.level.block.entity.generators.HeatGeneratorBlockEntity;
|
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
@ParametersAreNonnullByDefault
|
|
||||||
public class HeatGeneratorBlock extends SimpleBlockWithEntity<HeatGeneratorBlockEntity> {
|
|
||||||
public static final MapCodec<HeatGeneratorBlock> CODEC = simpleCodec(HeatGeneratorBlock::new);
|
|
||||||
|
|
||||||
public HeatGeneratorBlock(Properties pProperties) {
|
|
||||||
super(pProperties, ETBlockEntities.HEAT_GENERATOR_BLOCK_ENTITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected MapCodec<? extends BaseEntityBlock> codec() {
|
|
||||||
return CODEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
|
||||||
return new HeatGeneratorBlockEntity(pos, state);
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ loaderVersion="${loader_version_range}" #mandatory
|
|||||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
license="${mod_license}"
|
license="${mod_license}"
|
||||||
# A URL to refer people to when problems occur with this mod
|
# A URL to refer people to when problems occur with this mod
|
||||||
issueTrackerURL="https://git.robaertschi.xyz/robaertschi/EnvironmentTech/issues" #optional
|
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||||
[[mods]] #mandatory
|
[[mods]] #mandatory
|
||||||
# The modid of the mod
|
# The modid of the mod
|
||||||
@ -23,11 +23,11 @@ displayName="${mod_name}" #mandatory
|
|||||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforge.net/docs/misc/updatechecker/
|
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforge.net/docs/misc/updatechecker/
|
||||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
displayURL="https://git.robaertschi.xyz/robaertschi/EnvironmentTech" #optional
|
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||||
# A file name (in the root of the mod JAR) containing a logo for display
|
# A file name (in the root of the mod JAR) containing a logo for display
|
||||||
#logoFile="environmenttech.png" #optional
|
#logoFile="environmenttech.png" #optional
|
||||||
# A text field displayed in the mod UI
|
# A text field displayed in the mod UI
|
||||||
credits="KaupenJoe, BluSunrize" #optional
|
#credits="" #optional
|
||||||
# A text field displayed in the mod UI
|
# A text field displayed in the mod UI
|
||||||
authors="${mod_authors}" #optional
|
authors="${mod_authors}" #optional
|
||||||
# Display Test controls the display for your mod in the server connection screen
|
# Display Test controls the display for your mod in the server connection screen
|
||||||
@ -41,7 +41,6 @@ authors="${mod_authors}" #optional
|
|||||||
# The description text for the mod (multi line!) (#mandatory)
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
description='''${mod_description}'''
|
description='''${mod_description}'''
|
||||||
|
|
||||||
|
|
||||||
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
|
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
|
||||||
[[mixins]]
|
[[mixins]]
|
||||||
config="environmenttech.mixins.json"
|
config="environmenttech.mixins.json"
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
{
|
{
|
||||||
"item.environmenttech.env_detector": "ENV Detector",
|
"item.environmenttech.env_detector": "ENV Detector",
|
||||||
"item.environmenttech.env_detector.tooltip": "The ENV Detector is a handy device that shows you how much ENV is available in the current chunk. It can display from 0 to 16 ENV.",
|
|
||||||
"item.environmenttech.environmental_essence": "Environmental Essence",
|
"item.environmenttech.environmental_essence": "Environmental Essence",
|
||||||
"item.environmenttech.glass_tank": "Glass Tank",
|
"item.environmenttech.env_detector.tooltip": "The ENV Detector is a handy device that shows you how much ENV is available in the current chunk. It can display from 0 to 16 ENV.",
|
||||||
|
|
||||||
"block.environmenttech.env_collector": "ENV Collector",
|
"block.environmenttech.env_collector": "ENV Collector",
|
||||||
"block.environmenttech.env_distributor": "ENV Distributor",
|
|
||||||
|
|
||||||
"fluid_type.environmenttech.env": "ENV",
|
|
||||||
|
|
||||||
"itemGroup.environmenttech": "Environment Tech",
|
"itemGroup.environmenttech": "Environment Tech",
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user