feat: fluid filter implemented

This commit is contained in:
Andrew 2026-05-17 22:56:00 +07:00
commit 53d8e8bc91
39 changed files with 2223 additions and 0 deletions

21
.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
# MacOS DS_Store files
.DS_Store
# Gradle cache folder
.gradle
# Gradle build folder
build
# IntelliJ
out/
.idea
*.iml
# mpeltonen/sbt-idea plugin
.idea_modules/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Common working directory
run

157
build.gradle Normal file
View file

@ -0,0 +1,157 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'idea'
id 'net.neoforged.moddev' version '2.0.141'
id 'org.jetbrains.kotlin.jvm' version '2.3.0'
}
version = mod_version
group = mod_group_id
repositories {
mavenLocal()
maven {
name = 'Kotlin for Forge'
url = 'https://thedarkcolour.github.io/KotlinForForge/'
content { includeGroup "thedarkcolour" }
}
maven {
// for Patchouli and JEI
name "blamejared"
url "https://maven.blamejared.com/"
content {
includeGroup "vazkii.patchouli"
includeGroup "vazkii.psi"
includeGroup "mezz.jei"
}
}
maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
content {
includeGroup 'maven.modrinth'
}
}
exclusiveContent {
forRepository {
maven {
url "https://cursemaven.com"
}
}
filter {
includeGroup "curse.maven"
}
}
}
base {
archivesName = mod_id
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
kotlin.jvmToolchain(21)
neoForge {
version = project.neo_version
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}
runs {
client {
client()
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
server {
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
gameTestServer {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
data {
data()
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
logLevel = org.slf4j.event.Level.DEBUG
}
}
mods {
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
implementation 'thedarkcolour:kotlinforforge-neoforge:5.11.0'
implementation "curse.maven:mekanism-268560:7904058"
compileOnly "mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${jei_mc_version}-neoforge-api:${jei_version}"
runtimeOnly "mezz.jei:jei-${jei_mc_version}-neoforge:${jei_version}"
runtimeOnly("curse.maven:ftb-library-forge-404465:7746959")
runtimeOnly("curse.maven:architectury-api-419699:5786327")
}
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
sourceSets.main.resources.srcDir generateModMetadata
neoForge.ideSyncTask generateModMetadata
publishing {
publications {
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
maven {
url "file://${project.projectDir}/repo"
}
}
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}

44
gradle.properties Normal file
View file

@ -0,0 +1,44 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
org.gradle.jvmargs=-Xmx2G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
## Environment Properties
# 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
minecraft_version=1.21.1
# 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
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21.1,1.22)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.1.219
# The Neo version range can use any version of Neo as bounds
neo_version_range=[21,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[5.3,)
parchment_minecraft_version=1.21.11
parchment_mappings_version=2025.12.21-nightly-SNAPSHOT
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=effmeks
# The human-readable display name for the mod.
mod_name=EffectiveMekanisms
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=xyz.nuark.mcmod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=nuark
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Effective Mekanism machines, when you really want to save your tps
jei_version=19.25.0.323
jei_mc_version=1.21.1
patchouli_version=1.21-87

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

249
gradlew vendored Normal file
View file

@ -0,0 +1,249 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (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
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

92
gradlew.bat vendored Normal file
View file

@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

11
settings.gradle Normal file
View file

@ -0,0 +1,11 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven { url = 'https://maven.neoforged.net/releases' }
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

View file

@ -0,0 +1,2 @@
// 1.21.1 2026-05-17T14:12:39.0216262 Item Models: effmeks
8476e8e89257ef1bfcd9f568099f069a86522360 assets/effmeks/models/item/fluid_filter.json

View file

@ -0,0 +1,3 @@
// 1.21.1 2026-05-17T22:53:43.7145767 Recipes
c9ee48071b50617af2ec250deadd7bff323b8d78 data/effmeks/advancement/recipes/tools/rec_fct1.json
1ad62af4d88b8110dc39d966c289b1ff3d585397 data/effmeks/recipe/rec_fct1.json

View file

@ -0,0 +1,2 @@
// 1.21.1 2026-05-17T22:37:23.9653189 Languages: en_us for mod: effmeks
9b4d5b6a375bca8cb2f716c84981d5764fa820fc assets/effmeks/lang/en_us.json

View file

@ -0,0 +1,2 @@
// 1.21.1 2026-05-17T22:37:24.0183182 Languages: ru_ru for mod: effmeks
b430721f5d5170ca82c0af7ea851ab1c7c9bc91d assets/effmeks/lang/ru_ru.json

View file

@ -0,0 +1,6 @@
{
"block.effmeks.fluid_filter": "Fluid filter",
"tooltip.fluid.amount.format": "%s / %s mB of ",
"tooltip.fluid.empty": "Empty",
"tooltip.machine.overclock.tier": "Overclock tier: %s"
}

View file

@ -0,0 +1,6 @@
{
"block.effmeks.fluid_filter": "Жидкостный фильтр",
"tooltip.fluid.amount.format": "%s / %s мБ ",
"tooltip.fluid.empty": "Пусто",
"tooltip.machine.overclock.tier": "Уровень разгона: %s"
}

View file

@ -0,0 +1,3 @@
{
"parent": "effmeks:block/fluid_filter"
}

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_iron_block": {
"conditions": {
"items": [
{
"items": "mekanism:electric_pump"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "effmeks:rec_fct1"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_iron_block"
]
],
"rewards": {
"recipes": [
"effmeks:rec_fct1"
]
}
}

View file

@ -0,0 +1,27 @@
{
"type": "minecraft:crafting_shaped",
"category": "equipment",
"key": {
"C": {
"item": "mekanism:ultimate_control_circuit"
},
"F": {
"item": "mekanism:upgrade_filter"
},
"P": {
"item": "mekanism:electric_pump"
},
"T": {
"item": "mekanism:ultimate_fluid_tank"
}
},
"pattern": [
"CTC",
"FPF",
"CTC"
],
"result": {
"count": 1,
"id": "effmeks:fluid_filter"
}
}

View file

@ -0,0 +1,114 @@
package xyz.nuark.mcmod.effectivemekanisms
import xyz.nuark.mcmod.effectivemekanisms.block.ModBlocks
import net.minecraft.client.Minecraft
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.CreativeModeTabs
import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.fml.common.EventBusSubscriber
import net.neoforged.fml.common.Mod
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent
import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import thedarkcolour.kotlinforforge.neoforge.forge.MOD_BUS
import thedarkcolour.kotlinforforge.neoforge.forge.runForDist
import xyz.nuark.mcmod.effectivemekanisms.blockentity.ModBlockEntities
import xyz.nuark.mcmod.effectivemekanisms.datagen.ModItemModelProvider
import xyz.nuark.mcmod.effectivemekanisms.datagen.ModLanguageProviders
import xyz.nuark.mcmod.effectivemekanisms.datagen.ModRecipeProvider
import xyz.nuark.mcmod.effectivemekanisms.item.ModItems
import xyz.nuark.mcmod.effectivemekanisms.menu.ModMenuTypes
import xyz.nuark.mcmod.effectivemekanisms.network.FluidFilterOverclockPacket
import xyz.nuark.mcmod.effectivemekanisms.network.FluidFilterSyncPacket
import xyz.nuark.mcmod.effectivemekanisms.screen.FluidFilterScreen
@Mod(EffMeks.ID)
@EventBusSubscriber
object EffMeks {
const val ID = "effmeks"
val LOGGER: Logger = LogManager.getLogger(ID)
init {
LOGGER.log(Level.INFO, "Hello world!")
ModBlocks.REGISTRY.register(MOD_BUS)
ModBlockEntities.REGISTRY.register(MOD_BUS)
ModItems.REGISTRY.register(MOD_BUS)
ModMenuTypes.register(MOD_BUS)
val obj = runForDist(
clientTarget = {
MOD_BUS.addListener(::onClientSetup)
Minecraft.getInstance()
},
serverTarget = {
MOD_BUS.addListener(::onServerSetup)
"test"
})
println(obj)
}
private fun onClientSetup(event: FMLClientSetupEvent) {
LOGGER.log(Level.INFO, "Initializing client...")
}
private fun onServerSetup(event: FMLDedicatedServerSetupEvent) {
LOGGER.log(Level.INFO, "Server starting...")
}
@SubscribeEvent
fun buildContents(event: BuildCreativeModeTabContentsEvent) {
if (event.tabKey === CreativeModeTabs.FUNCTIONAL_BLOCKS) {
event.accept(ModItems.FLUID_FILTER_BLOCK.get())
}
}
@SubscribeEvent
fun registerScreens(event: RegisterMenuScreensEvent) {
event.register(ModMenuTypes.FLUID_FILTER.get(), ::FluidFilterScreen)
}
@SubscribeEvent
fun registerPayloads(event: RegisterPayloadHandlersEvent) {
event.registrar(ID).playToServer(
FluidFilterOverclockPacket.TYPE,
FluidFilterOverclockPacket.STREAM_CODEC,
FluidFilterOverclockPacket::handle
)
event.registrar(ID).playToClient(
FluidFilterSyncPacket.TYPE,
FluidFilterSyncPacket.STREAM_CODEC,
FluidFilterSyncPacket::handle
)
}
@SubscribeEvent
fun gatherData(event: GatherDataEvent) {
val existingFileHelper = event.existingFileHelper
val generator = event.generator
val output = generator.packOutput
val lookupProvider = event.lookupProvider
generator.addProvider(
event.includeClient(),
ModItemModelProvider(output, existingFileHelper)
)
ModLanguageProviders.provideProviders(generator, event.includeClient())
generator.addProvider(
event.includeServer(),
ModRecipeProvider(output, lookupProvider)
)
}
fun resource(name: String): ResourceLocation = ResourceLocation.fromNamespaceAndPath(ID, name)
}

View file

@ -0,0 +1,72 @@
package xyz.nuark.mcmod.effectivemekanisms.block
import com.mojang.serialization.MapCodec
import net.minecraft.core.BlockPos
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.BaseEntityBlock
import net.minecraft.world.level.block.RenderShape
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.BlockHitResult
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape
import xyz.nuark.mcmod.effectivemekanisms.blockentity.FluidFilterBlockEntity
import xyz.nuark.mcmod.effectivemekanisms.blockentity.ModBlockEntities
import java.util.stream.Stream
class FluidFilterBlock(properties: Properties) : BaseEntityBlock(properties) {
override fun newBlockEntity(pos: BlockPos, state: BlockState): BlockEntity =
FluidFilterBlockEntity(pos, state)
override fun codec(): MapCodec<out BaseEntityBlock?> = simpleCodec(::FluidFilterBlock)
override fun getRenderShape(state: BlockState): RenderShape = RenderShape.MODEL
override fun useWithoutItem(
state: BlockState,
level: Level,
pos: BlockPos,
player: Player,
hitResult: BlockHitResult
): InteractionResult {
if (level.isClientSide) return InteractionResult.SUCCESS
val be = level.getBlockEntity(pos) as? FluidFilterBlockEntity
?: return InteractionResult.PASS
if (player is ServerPlayer) {
player.openMenu(be) { buf -> buf.writeBlockPos(pos) }
}
return InteractionResult.CONSUME
}
override fun <T : BlockEntity> getTicker(
level: Level, state: BlockState, type: BlockEntityType<T>
): BlockEntityTicker<T>? =
createTickerHelper(type, ModBlockEntities.FLUID_FILTER.get(), FluidFilterBlockEntity::tick)
override fun getShape(
state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext
): VoxelShape = SHAPE
override fun getCollisionShape(
state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext
): VoxelShape = SHAPE
companion object {
val SHAPE: VoxelShape = Stream.of(
box(2.0, 2.0, 2.0, 14.0, 14.0, 14.0),
box(4.0, 14.0, 4.0, 12.0, 16.0, 12.0),
box(3.0, 0.0, 3.0, 13.0, 2.0, 13.0),
box(14.0, 5.0, 5.0, 16.0, 11.0, 11.0),
box(5.0, 5.0, 0.0, 11.0, 11.0, 2.0),
box(0.0, 5.0, 5.0, 2.0, 11.0, 11.0),
box(5.0, 5.0, 14.0, 11.0, 11.0, 16.0)
).reduce { v1, v2 -> Shapes.or(v1, v2) }.get()
}
}

View file

@ -0,0 +1,17 @@
package xyz.nuark.mcmod.effectivemekanisms.block
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.state.BlockBehaviour
import net.neoforged.neoforge.registries.DeferredBlock
import net.neoforged.neoforge.registries.DeferredRegister
import thedarkcolour.kotlinforforge.neoforge.forge.getValue
object ModBlocks {
val REGISTRY = DeferredRegister.createBlocks(EffMeks.ID)
val FLUID_FILTER: DeferredBlock<FluidFilterBlock> = REGISTRY.register("fluid_filter") { ->
FluidFilterBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK))
}
}

View file

@ -0,0 +1,159 @@
package xyz.nuark.mcmod.effectivemekanisms.blockentity
import net.minecraft.core.BlockPos
import net.minecraft.core.HolderLookup
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.chat.Component
import net.minecraft.world.MenuProvider
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.inventory.ContainerData
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.energy.EnergyStorage
import net.neoforged.neoforge.fluids.FluidStack
import net.neoforged.neoforge.fluids.capability.IFluidHandler
import net.neoforged.neoforge.fluids.capability.templates.FluidTank
import xyz.nuark.mcmod.effectivemekanisms.menu.FluidFilterMenu
import xyz.nuark.mcmod.effectivemekanisms.utils.FilterFluidConversion
import kotlin.math.pow
import kotlin.math.roundToInt
class FluidFilterBlockEntity(pos: BlockPos, state: BlockState) :
BlockEntity(ModBlockEntities.FLUID_FILTER.get(), pos, state), MenuProvider {
var ticksUntilOperation = TICKS_PER_OPERATION
var overclockTier: Int = 0
set(value) {
field = value.coerceIn(0, MAX_OVERCLOCK_TIER)
setChanged()
}
val overclockMultiplier: Int
get() = 1 shl overclockTier
val energyCostMultiplier: Double
get() = 2.5.pow(overclockTier.toDouble())
val energyUsageThisTick: Int
get() = (ENERGY_USAGE_PER_TICK * energyCostMultiplier).roundToInt()
val energyStorage = object : EnergyStorage(ENERGY_CAPACITY) {
override fun receiveEnergy(maxReceive: Int, simulate: Boolean): Int {
val received = super.receiveEnergy(maxReceive, simulate)
if (received > 0 && !simulate) setChanged()
return received
}
}
val inputTank = object : FluidTank(FLUID_CAPACITY, { fluidStack ->
FilterFluidConversion.filterConversions.any { fluidStack.`is`(it.from) }
}) {
override fun onContentsChanged() {
setChanged()
}
}
val outputTank = object : FluidTank(FLUID_CAPACITY, { fluidStack ->
FilterFluidConversion.filterConversions.any { fluidStack.`is`(it.to) }
}) {
override fun onContentsChanged() {
setChanged()
}
}
private fun processConversion(): Boolean {
val conversion = canProcess(inputTank.fluid) ?: return false
energyStorage.extractEnergy(energyUsageThisTick, false)
inputTank.drain(conversion.consume, IFluidHandler.FluidAction.EXECUTE)
outputTank.fill(FluidStack(conversion.to, conversion.produce), IFluidHandler.FluidAction.EXECUTE)
setChanged()
return true
}
private fun canProcess(input: FluidStack): FilterFluidConversion.ConversionRate? {
if (energyStorage.energyStored < energyUsageThisTick) return null
val base = FilterFluidConversion.filterConversions
.firstOrNull { input.`is`(it.from) } ?: return null
val mult = overclockMultiplier
val conversion = FilterFluidConversion.ConversionRate(
base.from, base.to,
base.consume * TICKS_PER_OPERATION * mult,
base.produce * TICKS_PER_OPERATION * mult
)
if (inputTank.fluidAmount < conversion.consume) return null
val outputTarget = FluidStack(conversion.to, conversion.produce)
if (outputTank.fill(outputTarget, IFluidHandler.FluidAction.SIMULATE) == 0) return null
if (outputTank.space < conversion.produce) return null
return conversion
}
override fun getDisplayName(): Component =
Component.translatable("block.effectivemekanisms.fluid_filter")
override fun createMenu(containerId: Int, playerInventory: Inventory, player: Player): AbstractContainerMenu =
FluidFilterMenu(containerId, playerInventory, this, buildContainerData())
private fun buildContainerData() = object : ContainerData {
override fun get(index: Int): Int = when (index) {
FluidFilterMenu.SLOT_ENERGY -> energyStorage.energyStored
FluidFilterMenu.SLOT_ENERGY_MAX -> energyStorage.maxEnergyStored
FluidFilterMenu.SLOT_INPUT_FLUID -> inputTank.fluidAmount
FluidFilterMenu.SLOT_OUTPUT_FLUID -> outputTank.fluidAmount
FluidFilterMenu.SLOT_FLUID_CAP -> FLUID_CAPACITY
FluidFilterMenu.SLOT_OVERCLOCK -> overclockTier
FluidFilterMenu.SLOT_PROGRESS -> ticksUntilOperation
else -> 0
}
override fun set(index: Int, value: Int) {
// Client can only update overclock tier, so only that handled here
if (index == FluidFilterMenu.SLOT_OVERCLOCK) overclockTier = value
}
override fun getCount() = FluidFilterMenu.DATA_SLOT_COUNT
}
override fun saveAdditional(tag: CompoundTag, registries: HolderLookup.Provider) {
super.saveAdditional(tag, registries)
tag.put("Energy", energyStorage.serializeNBT(registries))
tag.put("InputTank", inputTank.writeToNBT(registries, CompoundTag()))
tag.put("OutputTank", outputTank.writeToNBT(registries, CompoundTag()))
tag.putInt("OverclockTier", overclockTier)
}
override fun loadAdditional(tag: CompoundTag, registries: HolderLookup.Provider) {
super.loadAdditional(tag, registries)
energyStorage.deserializeNBT(registries, tag.get("Energy")!!)
inputTank.readFromNBT(registries, tag.getCompound("InputTank"))
outputTank.readFromNBT(registries, tag.getCompound("OutputTank"))
overclockTier = tag.getInt("OverclockTier")
}
companion object {
const val ENERGY_CAPACITY = 1_000_000_000
const val FLUID_CAPACITY = 400_000_000
const val ENERGY_USAGE_PER_TICK = 2_000
const val TICKS_PER_OPERATION = 20
const val MAX_OVERCLOCK_TIER = 12
fun tick(level: Level, pos: BlockPos, state: BlockState, be: FluidFilterBlockEntity) {
if (level.isClientSide) return
if (be.ticksUntilOperation > 0) {
be.ticksUntilOperation--; return
}
be.ticksUntilOperation = TICKS_PER_OPERATION
be.processConversion()
}
}
}

View file

@ -0,0 +1,18 @@
package xyz.nuark.mcmod.effectivemekanisms.blockentity
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.world.level.block.entity.BlockEntityType
import net.neoforged.neoforge.registries.DeferredHolder
import net.neoforged.neoforge.registries.DeferredRegister
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.block.ModBlocks
import thedarkcolour.kotlinforforge.neoforge.forge.getValue
object ModBlockEntities {
val REGISTRY = DeferredRegister.create(BuiltInRegistries.BLOCK_ENTITY_TYPE, EffMeks.ID)
val FLUID_FILTER: DeferredHolder<BlockEntityType<*>, BlockEntityType<FluidFilterBlockEntity>> = REGISTRY.register("fluid_filter") { ->
BlockEntityType.Builder.of(::FluidFilterBlockEntity, ModBlocks.FLUID_FILTER.get()).build(null)
}
}

View file

@ -0,0 +1,34 @@
package xyz.nuark.mcmod.effectivemekanisms.capabilities
import net.minecraft.core.Direction
import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.fml.common.EventBusSubscriber
import net.neoforged.neoforge.capabilities.Capabilities
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent
import xyz.nuark.mcmod.effectivemekanisms.blockentity.ModBlockEntities
@EventBusSubscriber
object ModCapabilities {
@SubscribeEvent
fun registerCapabilities(event: RegisterCapabilitiesEvent) {
ModBlockEntities.FLUID_FILTER.get().let {
event.registerBlockEntity(
Capabilities.EnergyStorage.BLOCK,
it
) { blockEntity, direction ->
blockEntity.energyStorage
}
event.registerBlockEntity(
Capabilities.FluidHandler.BLOCK,
it
) { blockEntity, direction ->
when (direction) {
Direction.DOWN -> blockEntity.outputTank
Direction.UP -> blockEntity.inputTank
else -> blockEntity.inputTank
}
}
}
}
}

View file

@ -0,0 +1,13 @@
package xyz.nuark.mcmod.effectivemekanisms.datagen
import net.minecraft.data.PackOutput
import net.neoforged.neoforge.client.model.generators.ItemModelProvider
import net.neoforged.neoforge.common.data.ExistingFileHelper
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.block.ModBlocks
class ModItemModelProvider(output: PackOutput, existingFileHelper: ExistingFileHelper) : ItemModelProvider(output, EffMeks.ID, existingFileHelper) {
override fun registerModels() {
simpleBlockItem(ModBlocks.FLUID_FILTER.get())
}
}

View file

@ -0,0 +1,32 @@
package xyz.nuark.mcmod.effectivemekanisms.datagen
import net.minecraft.data.DataGenerator
import net.minecraft.data.PackOutput
import net.neoforged.neoforge.common.data.LanguageProvider
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.item.ModItems
object ModLanguageProviders {
class ModRuRuLanguageProvider(output: PackOutput) : LanguageProvider(output, EffMeks.ID, "ru_ru") {
override fun addTranslations() {
add(ModItems.FLUID_FILTER_BLOCK.get(), "Жидкостный фильтр")
add("tooltip.fluid.empty", "Пусто")
add("tooltip.fluid.amount.format", "%s / %s мБ ")
add("tooltip.machine.overclock.tier", "Уровень разгона: %s")
}
}
class ModEnUsLanguageProvider(output: PackOutput) : LanguageProvider(output, EffMeks.ID, "en_us") {
override fun addTranslations() {
add(ModItems.FLUID_FILTER_BLOCK.get(), "Fluid filter")
add("tooltip.fluid.empty", "Empty")
add("tooltip.fluid.amount.format", "%s / %s mB of ")
add("tooltip.machine.overclock.tier", "Overclock tier: %s")
}
}
fun provideProviders(generator: DataGenerator, shouldRun: Boolean) {
generator.addProvider(shouldRun, ModRuRuLanguageProvider(generator.packOutput))
generator.addProvider(shouldRun, ModEnUsLanguageProvider(generator.packOutput))
}
}

View file

@ -0,0 +1,28 @@
package xyz.nuark.mcmod.effectivemekanisms.datagen
import mekanism.common.registries.MekanismBlocks
import mekanism.common.registries.MekanismItems
import net.minecraft.core.HolderLookup
import net.minecraft.data.PackOutput
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.RecipeProvider
import net.minecraft.data.recipes.ShapedRecipeBuilder
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.item.ModItems
import java.util.concurrent.CompletableFuture
class ModRecipeProvider(output: PackOutput, registries: CompletableFuture<HolderLookup.Provider>) : RecipeProvider(output, registries) {
override fun buildRecipes(recipeOutput: RecipeOutput) {
ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ModItems.FLUID_FILTER_BLOCK.get())
.pattern("CTC")
.pattern("FPF")
.pattern("CTC")
.define('T', MekanismBlocks.ULTIMATE_FLUID_TANK)
.define('P', MekanismBlocks.ELECTRIC_PUMP)
.define('F', MekanismItems.FILTER_UPGRADE)
.define('C', MekanismItems.ULTIMATE_CONTROL_CIRCUIT)
.unlockedBy("has_iron_block", has(MekanismBlocks.ELECTRIC_PUMP))
.save(recipeOutput, EffMeks.resource("rec_fct1"))
}
}

View file

@ -0,0 +1,13 @@
package xyz.nuark.mcmod.effectivemekanisms.item
import net.minecraft.world.item.BlockItem
import net.neoforged.neoforge.registries.DeferredItem
import net.neoforged.neoforge.registries.DeferredRegister
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.block.ModBlocks
object ModItems {
val REGISTRY = DeferredRegister.createItems(EffMeks.ID)
val FLUID_FILTER_BLOCK: DeferredItem<BlockItem> = REGISTRY.registerSimpleBlockItem(ModBlocks.FLUID_FILTER)
}

View file

@ -0,0 +1,112 @@
package xyz.nuark.mcmod.effectivemekanisms.menu
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.inventory.ContainerData
import net.minecraft.world.inventory.SimpleContainerData
import net.minecraft.world.item.ItemStack
import net.neoforged.neoforge.fluids.FluidStack
import net.neoforged.neoforge.network.PacketDistributor
import xyz.nuark.mcmod.effectivemekanisms.blockentity.FluidFilterBlockEntity
import xyz.nuark.mcmod.effectivemekanisms.network.FluidFilterSyncPacket
class FluidFilterMenu(
containerId: Int,
private val inventory: Inventory,
val blockEntity: FluidFilterBlockEntity,
private val data: ContainerData
) : AbstractContainerMenu(ModMenuTypes.FLUID_FILTER.get(), containerId) {
constructor(containerId: Int, inventory: Inventory, extraData: FriendlyByteBuf) : this(
containerId,
inventory,
inventory.player.level().getBlockEntity(extraData.readBlockPos()) as FluidFilterBlockEntity,
SimpleContainerData(DATA_SLOT_COUNT)
)
init {
checkContainerDataCount(data, DATA_SLOT_COUNT)
addDataSlots(data)
}
companion object {
const val DATA_SLOT_COUNT = 11
const val SLOT_ENERGY = 0 // energyStored
const val SLOT_ENERGY_MAX = 1 // maxEnergy
const val SLOT_INPUT_FLUID = 2 // inputAmount
const val SLOT_OUTPUT_FLUID = 3 // outputAmount
const val SLOT_FLUID_CAP = 4 // fluidCapacity
const val SLOT_OVERCLOCK = 5 // overclock tier
const val SLOT_PROGRESS = 6 // overclock tier
}
val energyStored: Int get() = data.get(SLOT_ENERGY)
val energyCapacity: Int get() = data.get(SLOT_ENERGY_MAX)
val inputFluidAmount: Int get() = data.get(SLOT_INPUT_FLUID)
val outputFluidAmount: Int get() = data.get(SLOT_OUTPUT_FLUID)
val fluidCapacity: Int get() = data.get(SLOT_FLUID_CAP)
val overclockTier: Int get() = data.get(SLOT_OVERCLOCK)
val ticksUntilOperation: Int get() = data.get(SLOT_PROGRESS)
val inputFluidStack get() = blockEntity.inputTank.fluid
val outputFluidStack get() = blockEntity.outputTank.fluid
private var lastInputFluid: FluidStack = FluidStack.EMPTY
private var lastOutputFluid: FluidStack = FluidStack.EMPTY
val processingProgress: Float
get() {
val total = FluidFilterBlockEntity.TICKS_PER_OPERATION
val remaining = ticksUntilOperation.coerceIn(0, total)
return 1f - remaining.toFloat() / total.toFloat()
}
override fun broadcastChanges() {
if (blockEntity.level?.isClientSide == false) {
data.set(SLOT_ENERGY, blockEntity.energyStorage.energyStored)
data.set(SLOT_ENERGY_MAX, blockEntity.energyStorage.maxEnergyStored)
data.set(SLOT_INPUT_FLUID, blockEntity.inputTank.fluidAmount)
data.set(SLOT_OUTPUT_FLUID, blockEntity.outputTank.fluidAmount)
data.set(SLOT_FLUID_CAP, FluidFilterBlockEntity.FLUID_CAPACITY)
data.set(SLOT_OVERCLOCK, blockEntity.overclockTier)
data.set(SLOT_PROGRESS, blockEntity.ticksUntilOperation)
val input = blockEntity.inputTank.fluid
val output = blockEntity.outputTank.fluid
if (!FluidStack.isSameFluidSameComponents(input, lastInputFluid) ||
!FluidStack.isSameFluidSameComponents(output, lastOutputFluid)
) {
lastInputFluid = input.copy()
lastOutputFluid = output.copy()
PacketDistributor.sendToPlayer(
inventory.player as ServerPlayer,
FluidFilterSyncPacket(blockEntity.blockPos, input, output)
)
}
}
super.broadcastChanges()
}
override fun quickMoveStack(
p0: Player,
p1: Int
): ItemStack = ItemStack.EMPTY // We are not moving any items
fun setOverclockTier(tier: Int) {
blockEntity.overclockTier = tier.coerceIn(0, FluidFilterBlockEntity.MAX_OVERCLOCK_TIER)
blockEntity.setChanged()
}
override fun stillValid(player: Player): Boolean =
player.distanceToSqr(
blockEntity.blockPos.x + 0.5,
blockEntity.blockPos.y + 0.5,
blockEntity.blockPos.z + 0.5
) < 64.0
}

View file

@ -0,0 +1,20 @@
package xyz.nuark.mcmod.effectivemekanisms.menu
import net.minecraft.core.registries.Registries
import net.minecraft.world.inventory.MenuType
import net.neoforged.bus.api.IEventBus
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension
import net.neoforged.neoforge.registries.DeferredHolder
import net.neoforged.neoforge.registries.DeferredRegister
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
object ModMenuTypes {
private val MENU_TYPES: DeferredRegister<MenuType<*>> =
DeferredRegister.create(Registries.MENU, EffMeks.ID)
val FLUID_FILTER: DeferredHolder<MenuType<*>, MenuType<FluidFilterMenu>> = MENU_TYPES.register("fluid_filter") { ->
IMenuTypeExtension.create(::FluidFilterMenu)
}
fun register(eventBus: IEventBus) = MENU_TYPES.register(eventBus)
}

View file

@ -0,0 +1,35 @@
package xyz.nuark.mcmod.effectivemekanisms.network
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.codec.StreamCodec
import net.minecraft.network.protocol.common.custom.CustomPacketPayload
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import net.neoforged.neoforge.network.handling.IPayloadContext
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.menu.FluidFilterMenu
data class FluidFilterOverclockPacket(val tier: Int) : CustomPacketPayload {
override fun type(): CustomPacketPayload.Type<FluidFilterOverclockPacket> = TYPE
companion object {
val TYPE = CustomPacketPayload.Type<FluidFilterOverclockPacket>(
ResourceLocation.fromNamespaceAndPath(EffMeks.ID, "fluid_filter_overclock")
)
val STREAM_CODEC: StreamCodec<FriendlyByteBuf, FluidFilterOverclockPacket> =
StreamCodec.of(
{ buf, pkt -> buf.writeVarInt(pkt.tier) },
{ buf -> FluidFilterOverclockPacket(buf.readVarInt()) }
)
fun handle(packet: FluidFilterOverclockPacket, context: IPayloadContext) {
context.enqueueWork {
val player = context.player() as? ServerPlayer ?: return@enqueueWork
val menu = player.containerMenu as? FluidFilterMenu ?: return@enqueueWork
menu.setOverclockTier(packet.tier)
}
}
}
}

View file

@ -0,0 +1,44 @@
package xyz.nuark.mcmod.effectivemekanisms.network
import net.minecraft.client.Minecraft
import net.minecraft.core.BlockPos
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.network.codec.StreamCodec
import net.minecraft.network.protocol.common.custom.CustomPacketPayload
import net.minecraft.resources.ResourceLocation
import net.neoforged.neoforge.fluids.FluidStack
import net.neoforged.neoforge.network.handling.IPayloadContext
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.blockentity.FluidFilterBlockEntity
class FluidFilterSyncPacket(
val pos: BlockPos,
val inputFluid: FluidStack,
val outputFluid: FluidStack
) : CustomPacketPayload {
override fun type(): CustomPacketPayload.Type<FluidFilterSyncPacket> = TYPE
companion object {
val TYPE = CustomPacketPayload.Type<FluidFilterSyncPacket>(
ResourceLocation.fromNamespaceAndPath(EffMeks.ID, "fluid_filter_sync")
)
val STREAM_CODEC: StreamCodec<RegistryFriendlyByteBuf, FluidFilterSyncPacket> =
StreamCodec.composite(
BlockPos.STREAM_CODEC, FluidFilterSyncPacket::pos,
FluidStack.STREAM_CODEC, FluidFilterSyncPacket::inputFluid,
FluidStack.STREAM_CODEC, FluidFilterSyncPacket::outputFluid,
::FluidFilterSyncPacket
)
fun handle(packet: FluidFilterSyncPacket, context: IPayloadContext) {
context.enqueueWork {
val level = Minecraft.getInstance().level ?: return@enqueueWork
val be = level.getBlockEntity(packet.pos) as? FluidFilterBlockEntity ?: return@enqueueWork
be.inputTank.fluid = packet.inputFluid
be.outputTank.fluid = packet.outputFluid
}
}
}
}

View file

@ -0,0 +1,336 @@
package xyz.nuark.mcmod.effectivemekanisms.screen
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.entity.player.Inventory
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions
import net.neoforged.neoforge.fluids.FluidStack
import net.neoforged.neoforge.network.PacketDistributor
import xyz.nuark.mcmod.effectivemekanisms.EffMeks
import xyz.nuark.mcmod.effectivemekanisms.menu.FluidFilterMenu
import xyz.nuark.mcmod.effectivemekanisms.network.FluidFilterOverclockPacket
import kotlin.math.pow
import kotlin.math.roundToInt
class FluidFilterScreen(
menu: FluidFilterMenu,
inventory: Inventory,
@Suppress("unused") title: Component
) : AbstractContainerScreen<FluidFilterMenu>(menu, inventory, Component.translatable("block.effmeks.fluid_filter")) {
companion object {
val GUI_TEXTURE: ResourceLocation = ResourceLocation.fromNamespaceAndPath(
EffMeks.ID, "textures/gui/fluid_filter.png"
)
const val BG_WIDTH = 195
const val BG_HEIGHT = 159
const val ROW1_Y = 27 // top of all main-row widgets
// Energy bar
const val ENERGY_X = 7
const val ENERGY_W = 12
const val ENERGY_H = 80
// Input tank
const val INPUT_X = 28
const val TANK_W = 32
const val TANK_H = 80
// Progress arrow (centred between tanks)
const val ARROW_X = 70
const val ARROW_Y = ROW1_Y + (TANK_H - 16) / 2 // vertically centred
const val ARROW_W = 24
const val ARROW_H = 16
// Output tank
const val OUTPUT_X = 104
// Overclock row
const val OC_LABEL_Y = 122
const val OC_Y = 132
const val OC_GAP = 8
const val OC_START_X = 8
const val TIER_COUNT = 12
const val COL_PANEL_BORDER = 0xFF45475A.toInt()
const val COL_TANK_EMPTY = 0xFF11111B.toInt()
const val COL_ARROW_EMPTY = 0xFF313244.toInt()
const val COL_ARROW_FILL = 0xFF89DCEB.toInt()
const val COL_TEXT = 0xFFCDD6F4.toInt()
const val COL_TEXT_DIM = 0xFF6C7086.toInt()
const val COL_SEPARATOR = 0xFF45475A.toInt()
}
private var hoveredOcBtn = -1
override fun init() {
super.init()
imageWidth = BG_WIDTH
imageHeight = BG_HEIGHT
titleLabelX = BG_WIDTH / 2
titleLabelY = 6
}
override fun render(graphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
renderBackground(graphics, mouseX, mouseY, partialTick)
super.render(graphics, mouseX, mouseY, partialTick)
renderTooltip(graphics, mouseX, mouseY)
}
override fun renderBg(graphics: GuiGraphics, partialTick: Float, mouseX: Int, mouseY: Int) {
val x = leftPos
val y = topPos
drawBackground(graphics, x, y)
graphics.drawString(font, "En.", x + ENERGY_X, y + ROW1_Y - 9, COL_TEXT_DIM, false)
graphics.drawString(font, "Input", x + INPUT_X, y + ROW1_Y - 9, COL_TEXT_DIM, false)
graphics.drawString(font, "Output", x + OUTPUT_X, y + ROW1_Y - 9, COL_TEXT_DIM, false)
drawEnergyBar(graphics, x + ENERGY_X, y + ROW1_Y, menu.energyStored, menu.energyCapacity)
drawFluidTank(
graphics,
x + INPUT_X,
y + ROW1_Y,
menu.inputFluidAmount,
menu.fluidCapacity,
menu.inputFluidStack
)
drawProgressArrow(graphics, x + ARROW_X, y + ARROW_Y, menu.processingProgress)
drawFluidTank(
graphics,
x + OUTPUT_X,
y + ROW1_Y,
menu.outputFluidAmount,
menu.fluidCapacity,
menu.outputFluidStack
)
graphics.fill(x + 4, y + OC_LABEL_Y - 4, x + BG_WIDTH - 4, y + OC_LABEL_Y - 3, COL_SEPARATOR)
graphics.drawString(font, "Overclock", x + OC_START_X, y + OC_LABEL_Y, COL_TEXT_DIM, false)
for (i in 0 until TIER_COUNT) {
val bx = x + OC_START_X + i * (OC_GAP + 8)
val by = y + OC_Y + 5
val isActive = i == menu.overclockTier
val hovered = i == hoveredOcBtn
SliderSectorButton.draw(
graphics, bx, by, isActive, hovered
)
}
val tier = menu.overclockTier
val outMult = 1 shl tier
val eMult = energyCostMultiplier(tier)
val statsLine = "I/O ×$outMult | Energy ×${String.format("%.1f", eMult)}"
graphics.drawString(font, statsLine, x + OC_START_X, y + OC_Y + 13, COL_TEXT_DIM, false)
}
override fun renderTooltip(graphics: GuiGraphics, mouseX: Int, mouseY: Int) {
val x = leftPos
val y = topPos
// Energy bar
if (isHovering(ENERGY_X, ROW1_Y, ENERGY_W, ENERGY_H, mouseX.toDouble(), mouseY.toDouble())) {
graphics.renderTooltip(
font, Component.literal(
"${fmtLarge(menu.energyStored)} / ${fmtLarge(menu.energyCapacity)} FE"
), mouseX, mouseY
)
return
}
// Input tank
if (isHovering(INPUT_X, ROW1_Y, TANK_W, TANK_H, mouseX.toDouble(), mouseY.toDouble())) {
val fs = menu.inputFluidStack
val name = if (fs.isEmpty) Component.translatable("tooltip.fluid.empty") else fs.hoverName
graphics.renderTooltip(
font, Component.translatable(
"tooltip.fluid.amount.format", fmtLarge(menu.inputFluidAmount), fmtLarge(menu.fluidCapacity)
).append(name), mouseX, mouseY
)
return
}
// Output tank
if (isHovering(OUTPUT_X, ROW1_Y, TANK_W, TANK_H, mouseX.toDouble(), mouseY.toDouble())) {
val fs = menu.outputFluidStack
val name = if (fs.isEmpty) Component.translatable("tooltip.fluid.empty") else fs.hoverName
graphics.renderTooltip(
font, Component.translatable(
"tooltip.fluid.amount.format", fmtLarge(menu.outputFluidAmount), fmtLarge(menu.fluidCapacity)
).append(name), mouseX, mouseY
)
return
}
// Overclock buttons
for (i in 0 until TIER_COUNT) {
val bx = OC_START_X + i * (OC_GAP + 8)
val by = OC_Y + 5
if (isHovering(bx, by, 8, 8, mouseX.toDouble(), mouseY.toDouble())) {
graphics.renderTooltip(
font,
Component.translatable("tooltip.machine.overclock.tier", (i + 1).toString()),
mouseX,
mouseY
)
return
}
}
}
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
for (i in 0 until TIER_COUNT) {
val bx = OC_START_X + i * (OC_GAP + 8)
val by = OC_Y + 5
if (isHovering(bx, by, 8, 8, mouseX, mouseY)) {
PacketDistributor.sendToServer(FluidFilterOverclockPacket(i))
return true
}
}
return super.mouseClicked(mouseX, mouseY, button)
}
override fun mouseMoved(mouseX: Double, mouseY: Double) {
hoveredOcBtn = (0 until TIER_COUNT).firstOrNull { i ->
val bx = OC_START_X + i * (OC_GAP + 8)
val by = OC_Y + 5
isHovering(bx, by, 8, 8, mouseX, mouseY)
} ?: -1
super.mouseMoved(mouseX, mouseY)
}
override fun renderLabels(graphics: GuiGraphics, mouseX: Int, mouseY: Int) {
val tw = font.width(title)
graphics.drawString(font, title, (imageWidth - tw) / 2, titleLabelY, COL_TEXT, false)
}
private fun drawBackground(graphics: GuiGraphics, x: Int, y: Int) {
graphics.blit(GUI_TEXTURE, x, y, 0, 0, BG_WIDTH, BG_HEIGHT)
}
private fun drawEnergyBar(graphics: GuiGraphics, x: Int, y: Int, stored: Int, capacity: Int) {
val filledH = (ENERGY_H * stored.toLong() / capacity.coerceAtLeast(1)).toInt().coerceIn(0, ENERGY_H)
val srcY = 0 + (ENERGY_H - filledH)
graphics.blit(
GUI_TEXTURE,
x, y + ENERGY_H - filledH,
195, srcY,
ENERGY_W, filledH
)
}
private fun drawFluidTank(
graphics: GuiGraphics, x: Int, y: Int,
amount: Int, capacity: Int, fluid: FluidStack
) {
graphics.fill(x, y, x + TANK_W, y + TANK_H, COL_TANK_EMPTY)
// Fluid fill
if (amount > 0 && capacity > 0) {
val colour = getFluidColor(fluid)
val filled = (TANK_H * amount.toLong() / capacity).toInt().coerceIn(0, TANK_H)
graphics.fill(x, y + TANK_H - filled, x + TANK_W, y + TANK_H, colour)
// Highlight shimmer at fill line
graphics.fill(x, y + TANK_H - filled, x + TANK_W, y + TANK_H - filled + 1, 0x55FFFFFF)
}
border(graphics, x, y, TANK_W, TANK_H, COL_PANEL_BORDER)
val pct = if (capacity > 0) (amount * 100L / capacity).toInt() else 0
graphics.drawString(font, "$pct%", x + 4, y + TANK_H + 2, COL_TEXT_DIM, false)
}
private fun drawProgressArrow(graphics: GuiGraphics, x: Int, y: Int, progress: Float) {
// Empty arrow body
graphics.fill(x, y, x + ARROW_W, y + ARROW_H, COL_ARROW_EMPTY)
// Filled portion
val filledW = (ARROW_W * progress).roundToInt().coerceIn(0, ARROW_W)
if (filledW > 0) {
graphics.fill(x, y, x + filledW, y + ARROW_H, COL_ARROW_FILL)
}
border(graphics, x, y, ARROW_W, ARROW_H, COL_PANEL_BORDER)
}
private fun energyCostMultiplier(tier: Int): Double = 2.5.pow(tier.toDouble())
private fun getFluidColor(fluid: FluidStack): Int {
if (fluid.isEmpty) return COL_TANK_EMPTY
return try {
IClientFluidTypeExtensions.of(fluid.fluid).tintColor or 0xFF000000.toInt()
} catch (_: Exception) {
0xFF3A7CC0.toInt()
}
}
private fun fmtLarge(v: Int): String = when {
v >= 1_000_000_000 -> "${v / 1_000_000_000}B"
v >= 1_000_000 -> "${v / 1_000_000}M"
v >= 1_000 -> "${v / 1_000}k"
else -> v.toString()
}
private fun border(graphics: GuiGraphics, x: Int, y: Int, w: Int, h: Int, col: Int) {
graphics.fill(x, y, x + w, y + 1, col)
graphics.fill(x, y + h - 1, x + w, y + h, col)
graphics.fill(x, y + 1, x + 1, y + h - 1, col)
graphics.fill(x + w - 1, y + 1, x + w, y + h - 1, col)
}
object SliderSectorButton {
private const val NORMAL_U = 207
private const val NORMAL_V = 0
private const val NORMAL_SIZE = 4
private const val HOVERED_U = 211
private const val HOVERED_V = 0
private const val HOVERED_SIZE = 6
private const val ACTIVE_U = 217
private const val ACTIVE_V = 0
private const val ACTIVE_SIZE = 8
fun draw(graphics: GuiGraphics, x: Int, y: Int, selected: Boolean, hovered: Boolean) {
if (selected) {
graphics.blit(
GUI_TEXTURE,
x - ACTIVE_SIZE / 2, y - ACTIVE_SIZE / 2,
ACTIVE_U, ACTIVE_V,
ACTIVE_SIZE, ACTIVE_SIZE
)
} else if (hovered) {
graphics.blit(
GUI_TEXTURE,
x - HOVERED_SIZE / 2,
y - HOVERED_SIZE / 2,
HOVERED_U,
HOVERED_V,
HOVERED_SIZE,
HOVERED_SIZE
)
} else {
graphics.blit(
GUI_TEXTURE,
x - NORMAL_SIZE / 2,
y - NORMAL_SIZE / 2,
NORMAL_U,
NORMAL_V,
NORMAL_SIZE,
NORMAL_SIZE
)
}
}
}
}

View file

@ -0,0 +1,18 @@
package xyz.nuark.mcmod.effectivemekanisms.tags
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.FluidTags
import net.minecraft.tags.TagKey
import net.minecraft.world.level.material.Fluid
object ModTags {
object Fluids {
val BRINE = commonTag("brine")
val LITHIUM = commonTag("lithium")
private fun commonTag(name: String): TagKey<Fluid> {
return FluidTags.create(ResourceLocation.fromNamespaceAndPath("c", name))
}
}
}

View file

@ -0,0 +1,20 @@
package xyz.nuark.mcmod.effectivemekanisms.utils
import mekanism.common.registries.MekanismFluids
import net.minecraft.tags.TagKey
import net.minecraft.world.level.material.Fluid
import net.neoforged.neoforge.common.Tags
import net.neoforged.neoforge.fluids.BaseFlowingFluid
object FilterFluidConversion {
data class ConversionRate(
val from: TagKey<Fluid>,
val to: BaseFlowingFluid.Source,
val consume: Int,
val produce: Int
)
val filterConversions = listOf(
ConversionRate(Tags.Fluids.WATER, MekanismFluids.HEAVY_WATER.get(), 6400, 1), // actually, 0.0156%, buuuuut....
)
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "effmeks:block/fluid_filter"
}
}
}

View file

@ -0,0 +1,388 @@
{
"format_version": "1.9.0",
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"0": "effmeks:block/fluid_filter",
"particle": "effmeks:block/fluid_filter"
},
"elements": [
{
"name": "body",
"from": [2, 2, 2],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [2, 2, 2]},
"faces": {
"north": {"uv": [0, 0, 3, 3], "texture": "#0"},
"east": {"uv": [0, 0, 3, 3], "texture": "#0"},
"south": {"uv": [0, 0, 3, 3], "texture": "#0"},
"west": {"uv": [0, 0, 3, 3], "texture": "#0"},
"up": {"uv": [6, 3, 3, 0], "texture": "#0"},
"down": {"uv": [6, 0, 3, 3], "texture": "#0"}
}
},
{
"name": "fluid_in",
"from": [4, 14, 4],
"to": [12, 16, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [4, 14, 4]},
"faces": {
"north": {"uv": [1.5, 4.5, 3, 5], "texture": "#0"},
"east": {"uv": [1.5, 5, 3, 5.5], "texture": "#0"},
"south": {"uv": [1.5, 4.5, 3, 5], "texture": "#0"},
"west": {"uv": [1.5, 5, 3, 5.5], "texture": "#0"},
"up": {"uv": [0, 4.5, 1.5, 6], "texture": "#0"},
"down": {"uv": [0.25, 4.75, 1.25, 5.75], "texture": "#0"}
}
},
{
"name": "fluid_out",
"from": [3, 0, 3],
"to": [13, 2, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [3, 0, 3]},
"faces": {
"north": {"uv": [1.5, 8, 3, 8.5], "texture": "#0"},
"east": {"uv": [1.5, 7.5, 3, 8], "texture": "#0"},
"south": {"uv": [1.5, 8, 3, 8.5], "texture": "#0"},
"west": {"uv": [1.5, 7.5, 3, 8], "texture": "#0"},
"up": {"uv": [3, 3, 6, 6], "texture": "#0"},
"down": {"uv": [0, 7.5, 1.5, 9], "texture": "#0"}
}
},
{
"name": "energyIn",
"from": [5, 5, 1],
"to": [11, 11, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 5, 1]},
"faces": {
"north": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"east": {"uv": [1, 6.25, 1.25, 7.25], "texture": "#0"},
"south": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"west": {"uv": [0.25, 6.25, 0.5, 7.25], "texture": "#0"},
"up": {"uv": [0.25, 6.25, 1.25, 6.5], "texture": "#0"},
"down": {"uv": [0.25, 7, 1.25, 7.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [5, 5, 0],
"to": [11, 6, 1],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 5, 0]},
"faces": {
"north": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"east": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"south": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"west": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"up": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"down": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [5, 10, 0],
"to": [11, 11, 1],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 10, 0]},
"faces": {
"north": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"east": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"},
"south": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"west": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"},
"up": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"down": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"}
}
},
{
"name": "frame",
"from": [10, 6, 0],
"to": [11, 10, 1],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 6, 0]},
"faces": {
"north": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"east": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"south": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"west": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"up": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"down": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [5, 6, 0],
"to": [6, 10, 1],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 6, 0]},
"faces": {
"north": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"east": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"south": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"west": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"up": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"down": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"}
}
},
{
"name": "energyIn",
"from": [5, 5, 14],
"to": [11, 11, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 5, 14]},
"faces": {
"north": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"east": {"uv": [1, 6.25, 1.25, 7.25], "texture": "#0"},
"south": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"west": {"uv": [0.25, 6.25, 0.5, 7.25], "texture": "#0"},
"up": {"uv": [0.25, 6.25, 1.25, 6.5], "texture": "#0"},
"down": {"uv": [0.25, 7, 1.25, 7.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [5, 5, 15],
"to": [11, 6, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 5, 15]},
"faces": {
"north": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"east": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"south": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"west": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"up": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"down": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [5, 10, 15],
"to": [11, 11, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 10, 15]},
"faces": {
"north": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"east": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"},
"south": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"west": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"},
"up": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"down": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"}
}
},
{
"name": "frame",
"from": [10, 6, 15],
"to": [11, 10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 6, 15]},
"faces": {
"north": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"east": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"south": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"west": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"up": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"down": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [5, 6, 15],
"to": [6, 10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 6, 15]},
"faces": {
"north": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"east": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"south": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"west": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"up": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"down": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"}
}
},
{
"name": "energyIn",
"from": [1, 5, 5],
"to": [2, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [2, 5, 5]},
"faces": {
"north": {"uv": [0.25, 6.25, 0.5, 7.25], "texture": "#0"},
"east": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"south": {"uv": [1, 6.25, 1.25, 7.25], "texture": "#0"},
"west": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"up": {"uv": [0.25, 6.25, 1.25, 6.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [0.25, 7, 1.25, 7.25], "rotation": 270, "texture": "#0"}
}
},
{
"name": "frame",
"from": [0, 5, 5],
"to": [1, 6, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [1, 5, 5]},
"faces": {
"north": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"east": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"south": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"west": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"up": {"uv": [0, 6, 1.5, 6.25], "rotation": 90, "texture": "#0"},
"down": {"uv": [0, 6, 1.5, 6.25], "rotation": 270, "texture": "#0"}
}
},
{
"name": "frame",
"from": [0, 10, 5],
"to": [1, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [1, 10, 5]},
"faces": {
"north": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"},
"east": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"south": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"},
"west": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"up": {"uv": [0, 7.25, 1.5, 7.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [0, 7.25, 1.5, 7.5], "rotation": 270, "texture": "#0"}
}
},
{
"name": "frame",
"from": [0, 6, 10],
"to": [1, 10, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 6, 10]},
"faces": {
"north": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"east": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"south": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"west": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"up": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"down": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [0, 6, 5],
"to": [1, 10, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 6, 5]},
"faces": {
"north": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"east": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"south": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"west": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"up": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"down": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"}
}
},
{
"name": "energyIn",
"from": [14, 5, 5],
"to": [15, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 5, 5]},
"faces": {
"north": {"uv": [0.25, 6.25, 0.5, 7.25], "texture": "#0"},
"east": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"south": {"uv": [1, 6.25, 1.25, 7.25], "texture": "#0"},
"west": {"uv": [0.25, 6.25, 1.25, 7.25], "texture": "#0"},
"up": {"uv": [0.25, 6.25, 1.25, 6.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [0.25, 7, 1.25, 7.25], "rotation": 270, "texture": "#0"}
}
},
{
"name": "frame",
"from": [15, 5, 5],
"to": [16, 6, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 5, 5]},
"faces": {
"north": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"east": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"south": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"west": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"up": {"uv": [0, 6, 1.5, 6.25], "rotation": 90, "texture": "#0"},
"down": {"uv": [0, 6, 1.5, 6.25], "rotation": 270, "texture": "#0"}
}
},
{
"name": "frame",
"from": [15, 10, 5],
"to": [16, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 10, 5]},
"faces": {
"north": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"},
"east": {"uv": [0, 6, 1.5, 6.25], "texture": "#0"},
"south": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"},
"west": {"uv": [0, 7.25, 1.5, 7.5], "texture": "#0"},
"up": {"uv": [0, 7.25, 1.5, 7.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [0, 7.25, 1.5, 7.5], "rotation": 270, "texture": "#0"}
}
},
{
"name": "frame",
"from": [15, 6, 10],
"to": [16, 10, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 6, 10]},
"faces": {
"north": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"east": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"south": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"west": {"uv": [0, 6.25, 0.25, 7.25], "texture": "#0"},
"up": {"uv": [0, 7.25, 0.25, 7.5], "texture": "#0"},
"down": {"uv": [0, 6, 0.25, 6.25], "texture": "#0"}
}
},
{
"name": "frame",
"from": [15, 6, 5],
"to": [16, 10, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 6, 5]},
"faces": {
"north": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"east": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"south": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"west": {"uv": [1.25, 6.25, 1.5, 7.25], "texture": "#0"},
"up": {"uv": [1.25, 7.25, 1.5, 7.5], "texture": "#0"},
"down": {"uv": [1.25, 6, 1.5, 6.25], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"scale": [0.6, 0.6, 0.6]
},
"thirdperson_lefthand": {
"scale": [0.6, 0.6, 0.6]
},
"firstperson_righthand": {
"scale": [0.6, 0.6, 0.6]
},
"ground": {
"translation": [0, 5, 0],
"scale": [0.75, 0.75, 0.75]
},
"gui": {
"rotation": [22.5, 45, 0],
"scale": [0.75, 0.75, 0.75]
},
"head": {
"scale": [1.5, 1.5, 1.5]
}
},
"groups": [
0,
1,
2,
{
"name": "energyIn",
"origin": [14, 5, 5],
"scope": 0,
"color": 0,
"children": [3, 4, 5, 6, 7]
},
{
"name": "energyIn",
"origin": [14, 5, 5],
"scope": 0,
"color": 0,
"children": [8, 9, 10, 11, 12]
},
{
"name": "energyIn",
"origin": [14, 5, 5],
"scope": 0,
"color": 0,
"children": [13, 14, 15, 16, 17]
},
{
"name": "energyIn",
"origin": [14, 5, 5],
"scope": 0,
"color": 0,
"children": [18, 19, 20, 21, 22]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,79 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader = "kotlinforforge" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the the FML version. This is currently 47.
loaderVersion = "${loader_version_range}" #mandatory
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license = "${mod_license}"
# A URL to refer people to when problems occur with this mod
#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
[[mods]] #mandatory
# The modid of the mod
modId = "${mod_id}" #mandatory
# The version number of the mod
version = "${mod_version}" #mandatory
# A display name for the mod
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/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#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
#logoFile="effmeks.png" #optional
# A text field displayed in the mod UI
#credits="" #optional
# A text field displayed in the mod UI
authors = "${mod_authors}" #optional
# The description text for the mod (multi line!) (#mandatory)
description = '''${mod_description}'''
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
#[[mixins]]
#config="${mod_id}.mixins.json"
# The [[accessTransformers]] block allows you to declare where your AT file is.
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
#[[accessTransformers]]
#file="META-INF/accesstransformer.cfg"
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies."${mod_id}"]] #optional
# the modid of the dependency
modId = "neoforge" #mandatory
# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive).
# 'required' requires the mod to exist, 'optional' does not
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
type = "required" #mandatory
# Optional field describing why the dependency is required or why it is incompatible
# reason="..."
# The version range of the dependency
versionRange = "${neo_version_range}" #mandatory
# An ordering relationship for the dependency.
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering = "NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side = "BOTH"
# Here's another dependency
[[dependencies."${mod_id}"]]
modId = "minecraft"
type = "required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange = "${minecraft_version_range}"
ordering = "NONE"
side = "BOTH"
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
# stop your mod loading on the server for example.
#[features."${mod_id}"]
#openGLVersion="[3.2,)"