diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/LICENSE b/LICENSE index 2071b23..bbb0e89 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,21 @@ -MIT License +The MIT License (MIT) -Copyright (c) +Copyright (c) 2023 TheClashFruit -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..be234bc --- /dev/null +++ b/build.gradle @@ -0,0 +1,94 @@ +plugins { + id 'fabric-loom' version '1.1-SNAPSHOT' + id 'maven-publish' +} + +version = project.mod_version +group = project.maven_group + +repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. + + maven { + name = 'CottonMC' + url = 'https://server.bbkr.space/artifactory/libs-release' + } +} + +dependencies { + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Fabric API. This is technically optional, but you probably want it anyway. + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + include modApi('teamreborn:energy:3.0.0') { + exclude(group: "net.fabricmc.fabric-api") + } + + include modApi('io.github.cottonmc:LibGui:7.0.0-rc.1+1.19.4') { + exclude(group: "net.fabricmc.fabric-api") + } +} + +processResources { + inputs.property "version", project.version + filteringCharset "UTF-8" + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +def targetJavaVersion = 17 +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { + it.options.release = targetJavaVersion + } +} + +java { + def javaVersion = JavaVersion.toVersion(targetJavaVersion) + if (JavaVersion.current() < javaVersion) { + toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) + } + archivesBaseName = project.archives_base_name + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() +} + +jar { + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}" } + } +} + +// configure the maven publication +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..82bca87 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,14 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G +# Fabric Properties +# check these on https://modmuss50.me/fabric.html +minecraft_version=1.19.4 +yarn_mappings=1.19.4+build.2 +loader_version=0.14.19 +# Mod Properties +mod_version=1.0-SNAPSHOT +maven_group=me.theclashfruit +archives_base_name=gtm +# Dependencies +# check this on https://modmuss50.me/fabric.html +fabric_version=0.77.0+1.19.4 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..41d9927 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..aa991fc --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/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/master/subprojects/plugins/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 + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# 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"' + +# 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 + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + 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 + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# 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" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@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=. +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%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +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%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..f91a4fe --- /dev/null +++ b/settings.gradle @@ -0,0 +1,9 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + gradlePluginPortal() + } +} diff --git a/src/main/java/me/theclashfruit/gtm/GenericTech.java b/src/main/java/me/theclashfruit/gtm/GenericTech.java new file mode 100644 index 0000000..48e5e5a --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/GenericTech.java @@ -0,0 +1,78 @@ +package me.theclashfruit.gtm; + +import me.theclashfruit.gtm.block.*; +import me.theclashfruit.gtm.block.entity.ClayInsulatorEntity; +import me.theclashfruit.gtm.block.entity.CoalGeneratorEntity; +import me.theclashfruit.gtm.inventory.CoalGeneratorGuiDescription; +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.biome.v1.BiomeModifications; +import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import net.minecraft.block.Material; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.item.BlockItem; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resource.featuretoggle.FeatureFlags; +import net.minecraft.screen.ScreenHandlerContext; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.util.Identifier; +import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.feature.PlacedFeature; +import team.reborn.energy.api.EnergyStorage; + +public class GenericTech implements ModInitializer { + public static final ClayInsulator CLAY_INSULATOR = new ClayInsulator(FabricBlockSettings.of(Material.STONE).hardness(0.5f)); + + public static final OakPost OAK_POST = new OakPost(FabricBlockSettings.of(Material.WOOD).hardness(2.0f)); + + public static final CoalGenerator COAL_GENERATOR = new CoalGenerator(FabricBlockSettings.of(Material.STONE).hardness(3.5f)); + + public static final UraniumOre URANIUM_ORE = new UraniumOre(FabricBlockSettings.of(Material.STONE).hardness(3.5f).requiresTool()); + public static final UraniumDeepslateOre URANIUM_ORE_DEEPLSATE = new UraniumDeepslateOre(FabricBlockSettings.of(Material.STONE).hardness(3.5f).requiresTool()); + + public static final BlockEntityType COAL_GENERATOR_ENTITY = Registry.register( + Registries.BLOCK_ENTITY_TYPE, + new Identifier("gtm", "coal_generator_entity"), + FabricBlockEntityTypeBuilder.create(CoalGeneratorEntity::new, COAL_GENERATOR).build() + ); + + public static final BlockEntityType CLAY_INSULATOR_ENTITY = Registry.register( + Registries.BLOCK_ENTITY_TYPE, + new Identifier("gtm", "clay_insulator_entity"), + FabricBlockEntityTypeBuilder.create(ClayInsulatorEntity::new, CLAY_INSULATOR).build() + ); + + public static final ScreenHandlerType SCREEN_HANDLER_TYPE = Registry.register(Registries.SCREEN_HANDLER, new Identifier("gtm", "coal_generator"), + new ScreenHandlerType<>((syncId, inventory) -> new CoalGeneratorGuiDescription(syncId, inventory, ScreenHandlerContext.EMPTY), + FeatureFlags.VANILLA_FEATURES)); + + public static final RegistryKey CUSTOM_ORE_PLACED_KEY = RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier("gtm","uranium_ore")); + + @Override + public void onInitialize() { + Registry.register(Registries.BLOCK, new Identifier("gtm", "clay_insulator"), CLAY_INSULATOR); + Registry.register(Registries.ITEM, new Identifier("gtm", "clay_insulator"), new BlockItem(CLAY_INSULATOR, new FabricItemSettings())); + + Registry.register(Registries.BLOCK, new Identifier("gtm", "oak_post"), OAK_POST); + Registry.register(Registries.ITEM, new Identifier("gtm", "oak_post"), new BlockItem(OAK_POST, new FabricItemSettings())); + + Registry.register(Registries.BLOCK, new Identifier("gtm", "coal_generator"), COAL_GENERATOR); + Registry.register(Registries.ITEM, new Identifier("gtm", "coal_generator"), new BlockItem(COAL_GENERATOR, new FabricItemSettings())); + + Registry.register(Registries.BLOCK, new Identifier("gtm", "uranium_ore"), URANIUM_ORE); + Registry.register(Registries.ITEM, new Identifier("gtm", "uranium_ore"), new BlockItem(URANIUM_ORE, new FabricItemSettings())); + + Registry.register(Registries.BLOCK, new Identifier("gtm", "uranium_deepslate_ore"), URANIUM_ORE_DEEPLSATE); + Registry.register(Registries.ITEM, new Identifier("gtm", "uranium_deepslate_ore"), new BlockItem(URANIUM_ORE_DEEPLSATE, new FabricItemSettings())); + + BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, CUSTOM_ORE_PLACED_KEY); + + EnergyStorage.SIDED.registerForBlockEntity((myBlockEntity, direction) -> myBlockEntity.energyStorage, COAL_GENERATOR_ENTITY); + EnergyStorage.SIDED.registerForBlockEntity((myBlockEntity, direction) -> myBlockEntity.energyStorage, CLAY_INSULATOR_ENTITY); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/ClayInsulator.java b/src/main/java/me/theclashfruit/gtm/block/ClayInsulator.java new file mode 100644 index 0000000..5424cae --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/ClayInsulator.java @@ -0,0 +1,25 @@ +package me.theclashfruit.gtm.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; + +public class ClayInsulator extends Block { + public ClayInsulator(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { + return VoxelShapes.union( + Block.createCuboidShape(7, 1, 7, 9, 6, 9), + Block.createCuboidShape(6, 0, 6, 10, 1, 10), + Block.createCuboidShape(6, 4, 6, 10, 5, 10), + Block.createCuboidShape(6, 2, 6, 10, 3, 10) + ); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/CoalGenerator.java b/src/main/java/me/theclashfruit/gtm/block/CoalGenerator.java new file mode 100644 index 0000000..4f7182d --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/CoalGenerator.java @@ -0,0 +1,37 @@ +package me.theclashfruit.gtm.block; + +import me.theclashfruit.gtm.GenericTech; +import me.theclashfruit.gtm.block.entity.CoalGeneratorEntity; +import net.minecraft.block.Block; +import net.minecraft.block.BlockEntityProvider; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; +import team.reborn.energy.api.EnergyStorage; + +public class CoalGenerator extends Block implements BlockEntityProvider { + public CoalGenerator(Settings settings) { + super(settings); + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new CoalGeneratorEntity(pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + Inventory blockEntity = (Inventory) world.getBlockEntity(pos); + + player.openHandledScreen(state.createScreenHandlerFactory(world, pos)); + return ActionResult.SUCCESS; + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/OakPost.java b/src/main/java/me/theclashfruit/gtm/block/OakPost.java new file mode 100644 index 0000000..6b10c3e --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/OakPost.java @@ -0,0 +1,24 @@ +package me.theclashfruit.gtm.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; + +public class OakPost extends Block { + + public OakPost(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { + return VoxelShapes.union( + Block.createCuboidShape(5, 0, 5, 11, 16, 11), + Block.createCuboidShape(6, 16, 6, 10, 32, 10) + ); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/UraniumDeepslateOre.java b/src/main/java/me/theclashfruit/gtm/block/UraniumDeepslateOre.java new file mode 100644 index 0000000..24a7876 --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/UraniumDeepslateOre.java @@ -0,0 +1,9 @@ +package me.theclashfruit.gtm.block; + +import net.minecraft.block.Block; + +public class UraniumDeepslateOre extends Block { + public UraniumDeepslateOre(Settings settings) { + super(settings); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/UraniumOre.java b/src/main/java/me/theclashfruit/gtm/block/UraniumOre.java new file mode 100644 index 0000000..6ed1448 --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/UraniumOre.java @@ -0,0 +1,9 @@ +package me.theclashfruit.gtm.block; + +import net.minecraft.block.Block; + +public class UraniumOre extends Block { + public UraniumOre(Settings settings) { + super(settings); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/entity/ClayInsulatorEntity.java b/src/main/java/me/theclashfruit/gtm/block/entity/ClayInsulatorEntity.java new file mode 100644 index 0000000..132829a --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/entity/ClayInsulatorEntity.java @@ -0,0 +1,20 @@ +package me.theclashfruit.gtm.block.entity; + +import me.theclashfruit.gtm.GenericTech; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import team.reborn.energy.api.base.SimpleEnergyStorage; + +public class ClayInsulatorEntity extends BlockEntity { + public final SimpleEnergyStorage energyStorage = new SimpleEnergyStorage(10, 10, 10) { + @Override + protected void onFinalCommit() { + markDirty(); + } + }; + + public ClayInsulatorEntity(BlockPos pos, BlockState state) { + super(GenericTech.COAL_GENERATOR_ENTITY, pos, state); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/block/entity/CoalGeneratorEntity.java b/src/main/java/me/theclashfruit/gtm/block/entity/CoalGeneratorEntity.java new file mode 100644 index 0000000..2590cd2 --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/block/entity/CoalGeneratorEntity.java @@ -0,0 +1,86 @@ +package me.theclashfruit.gtm.block.entity; + +import me.theclashfruit.gtm.GenericTech; +import me.theclashfruit.gtm.block.CoalGenerator; +import me.theclashfruit.gtm.inventory.CoalGeneratorGui; +import me.theclashfruit.gtm.inventory.CoalGeneratorGuiDescription; +import me.theclashfruit.gtm.inventory.ImplementedInventory; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.LootableContainerBlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.Inventories; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerContext; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.ItemScatterer; +import net.minecraft.util.collection.DefaultedList; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import team.reborn.energy.api.base.SimpleEnergyStorage; + +public class CoalGeneratorEntity extends LootableContainerBlockEntity { + private DefaultedList items = DefaultedList.ofSize(1, ItemStack.EMPTY); + + public final SimpleEnergyStorage energyStorage = new SimpleEnergyStorage(1000, 0, 100) { + @Override + protected void onFinalCommit() { + markDirty(); + } + }; + + public CoalGeneratorEntity(BlockPos pos, BlockState state) { + super(GenericTech.COAL_GENERATOR_ENTITY, pos, state); + } + + @Override + public Text getDisplayName() { + return Text.translatable(getCachedState().getBlock().getTranslationKey()); + } + + @Override + protected Text getContainerName() { + return Text.translatable(getCachedState().getBlock().getTranslationKey()); + } + + @Override + protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) { + return new CoalGeneratorGuiDescription(syncId, playerInventory, ScreenHandlerContext.create(world, pos)); + } + + @Override + public void readNbt(NbtCompound nbt) { + super.readNbt(nbt); + + Inventories.readNbt(nbt, items); + } + + @Override + public void writeNbt(NbtCompound nbt) { + super.writeNbt(nbt); + + Inventories.writeNbt(nbt, items); + } + + @Override + protected DefaultedList getInvStackList() { + return items; + } + + @Override + protected void setInvStackList(DefaultedList list) { + items = list; + } + + @Override + public int size() { + return items.size(); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/client/GenericTechClient.java b/src/main/java/me/theclashfruit/gtm/client/GenericTechClient.java new file mode 100644 index 0000000..50b9f0a --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/client/GenericTechClient.java @@ -0,0 +1,17 @@ +package me.theclashfruit.gtm.client; + +import me.theclashfruit.gtm.GenericTech; +import me.theclashfruit.gtm.inventory.CoalGeneratorGui; +import me.theclashfruit.gtm.inventory.CoalGeneratorGuiDescription; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screen.ingame.HandledScreens; + +@Environment(EnvType.CLIENT) +public class GenericTechClient implements ClientModInitializer { + @Override + public void onInitializeClient() { + HandledScreens.register(GenericTech.SCREEN_HANDLER_TYPE, (gui, inventory, title) -> new CoalGeneratorGui(gui, inventory.player, title)); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/inventory/CoalGeneratorGui.java b/src/main/java/me/theclashfruit/gtm/inventory/CoalGeneratorGui.java new file mode 100644 index 0000000..f2e5980 --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/inventory/CoalGeneratorGui.java @@ -0,0 +1,18 @@ +package me.theclashfruit.gtm.inventory; + +import io.github.cottonmc.cotton.gui.SyncedGuiDescription; +import io.github.cottonmc.cotton.gui.client.CottonInventoryScreen; +import io.github.cottonmc.cotton.gui.widget.WGridPanel; +import io.github.cottonmc.cotton.gui.widget.WItemSlot; +import io.github.cottonmc.cotton.gui.widget.data.Insets; +import me.theclashfruit.gtm.GenericTech; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandlerContext; +import net.minecraft.text.Text; + +public class CoalGeneratorGui extends CottonInventoryScreen { + public CoalGeneratorGui(CoalGeneratorGuiDescription gui, PlayerEntity player, Text title) { + super(gui, player, title); + } +} \ No newline at end of file diff --git a/src/main/java/me/theclashfruit/gtm/inventory/CoalGeneratorGuiDescription.java b/src/main/java/me/theclashfruit/gtm/inventory/CoalGeneratorGuiDescription.java new file mode 100644 index 0000000..6d2a050 --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/inventory/CoalGeneratorGuiDescription.java @@ -0,0 +1,29 @@ +package me.theclashfruit.gtm.inventory; + +import io.github.cottonmc.cotton.gui.SyncedGuiDescription; +import io.github.cottonmc.cotton.gui.widget.WGridPanel; +import io.github.cottonmc.cotton.gui.widget.WItemSlot; +import io.github.cottonmc.cotton.gui.widget.data.Insets; +import me.theclashfruit.gtm.GenericTech; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandlerContext; + +public class CoalGeneratorGuiDescription extends SyncedGuiDescription { + private static final int INVENTORY_SIZE = 1; + + public CoalGeneratorGuiDescription(int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) { + super(GenericTech.SCREEN_HANDLER_TYPE, syncId, playerInventory, getBlockInventory(context, INVENTORY_SIZE), getBlockPropertyDelegate(context)); + + WGridPanel root = new WGridPanel(); + setRootPanel(root); + root.setSize(300, 200); + root.setInsets(Insets.ROOT_PANEL); + + WItemSlot itemSlot = WItemSlot.of(blockInventory, 0); + root.add(itemSlot, 4, 1); + + root.add(this.createPlayerInventoryPanel(), 0, 3); + + root.validate(this); + } +} diff --git a/src/main/java/me/theclashfruit/gtm/inventory/ImplementedInventory.java b/src/main/java/me/theclashfruit/gtm/inventory/ImplementedInventory.java new file mode 100644 index 0000000..db0769c --- /dev/null +++ b/src/main/java/me/theclashfruit/gtm/inventory/ImplementedInventory.java @@ -0,0 +1,132 @@ +package me.theclashfruit.gtm.inventory; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventories; +import net.minecraft.inventory.Inventory; +import net.minecraft.inventory.SidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; + +/** + * A simple {@code Inventory} implementation with only default methods + an item list getter. + * + * Originally by Juuz + */ +public interface ImplementedInventory extends Inventory { + + /** + * Retrieves the item list of this inventory. + * Must return the same instance every time it's called. + */ + DefaultedList getItems(); + + /** + * Creates an inventory from the item list. + */ + static ImplementedInventory of(DefaultedList items) { + return () -> items; + } + + /** + * Creates a new inventory with the specified size. + */ + static ImplementedInventory ofSize(int size) { + return of(DefaultedList.ofSize(size, ItemStack.EMPTY)); + } + + /** + * Returns the inventory size. + */ + @Override + default int size() { + return getItems().size(); + } + + /** + * Checks if the inventory is empty. + * @return true if this inventory has only empty stacks, false otherwise. + */ + @Override + default boolean isEmpty() { + for (int i = 0; i < size(); i++) { + ItemStack stack = getStack(i); + if (!stack.isEmpty()) { + return false; + } + } + return true; + } + + /** + * Retrieves the item in the slot. + */ + @Override + default ItemStack getStack(int slot) { + return getItems().get(slot); + } + + /** + * Removes items from an inventory slot. + * @param slot The slot to remove from. + * @param count How many items to remove. If there are less items in the slot than what are requested, + * takes all items in that slot. + */ + @Override + default ItemStack removeStack(int slot, int count) { + ItemStack result = Inventories.splitStack(getItems(), slot, count); + if (!result.isEmpty()) { + markDirty(); + } + return result; + } + + /** + * Removes all items from an inventory slot. + * @param slot The slot to remove from. + */ + @Override + default ItemStack removeStack(int slot) { + return Inventories.removeStack(getItems(), slot); + } + + /** + * Replaces the current stack in an inventory slot with the provided stack. + * @param slot The inventory slot of which to replace the itemstack. + * @param stack The replacing itemstack. If the stack is too big for + * this inventory ({@link Inventory#getMaxCountPerStack()}), + * it gets resized to this inventory's maximum amount. + */ + @Override + default void setStack(int slot, ItemStack stack) { + getItems().set(slot, stack); + if (stack.getCount() > stack.getMaxCount()) { + stack.setCount(stack.getMaxCount()); + } + } + + /** + * Clears the inventory. + */ + @Override + default void clear() { + getItems().clear(); + } + + /** + * Marks the state as dirty. + * Must be called after changes in the inventory, so that the game can properly save + * the inventory contents and notify neighboring blocks of inventory changes. + */ + @Override + default void markDirty() { + // Override if you want behavior. + } + + /** + * @return true if the player can use the inventory, false otherwise. + */ + @Override + default boolean canPlayerUse(PlayerEntity player) { + return true; + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/blockstates/clay_insulator.json b/src/main/resources/assets/gtm/blockstates/clay_insulator.json new file mode 100644 index 0000000..6e2dafb --- /dev/null +++ b/src/main/resources/assets/gtm/blockstates/clay_insulator.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "gtm:block/clay_insulator", "uvlock": true } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/blockstates/coal_generator.json b/src/main/resources/assets/gtm/blockstates/coal_generator.json new file mode 100644 index 0000000..bfb3450 --- /dev/null +++ b/src/main/resources/assets/gtm/blockstates/coal_generator.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "gtm:block/coal_generator", "uvlock": true } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/blockstates/oak_post.json b/src/main/resources/assets/gtm/blockstates/oak_post.json new file mode 100644 index 0000000..3bcfeaa --- /dev/null +++ b/src/main/resources/assets/gtm/blockstates/oak_post.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "gtm:block/oak_post", "uvlock": true } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/blockstates/uranium_deepslate_ore.json b/src/main/resources/assets/gtm/blockstates/uranium_deepslate_ore.json new file mode 100644 index 0000000..b6bdb21 --- /dev/null +++ b/src/main/resources/assets/gtm/blockstates/uranium_deepslate_ore.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "gtm:block/uranium_deepslate_ore", "uvlock": true } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/blockstates/uranium_ore.json b/src/main/resources/assets/gtm/blockstates/uranium_ore.json new file mode 100644 index 0000000..9728be9 --- /dev/null +++ b/src/main/resources/assets/gtm/blockstates/uranium_ore.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "gtm:block/uranium_ore", "uvlock": true } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/icon.png b/src/main/resources/assets/gtm/icon.png new file mode 100644 index 0000000..e1acc8b Binary files /dev/null and b/src/main/resources/assets/gtm/icon.png differ diff --git a/src/main/resources/assets/gtm/lang/en_us.json b/src/main/resources/assets/gtm/lang/en_us.json new file mode 100644 index 0000000..9e49781 --- /dev/null +++ b/src/main/resources/assets/gtm/lang/en_us.json @@ -0,0 +1,8 @@ +{ + "block.gtm.clay_insulator": "Clay Insulator", + "block.gtm.oak_post": "Oak Post", + + "block.gtm.coal_generator": "Coal Generator", + "block.gtm.uranium_ore": "Uranium Ore", + "block.gtm.uranium_deepslate_ore": "Deepslate Uranium Ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/block/clay_insulator.json b/src/main/resources/assets/gtm/models/block/clay_insulator.json new file mode 100644 index 0000000..bed0315 --- /dev/null +++ b/src/main/resources/assets/gtm/models/block/clay_insulator.json @@ -0,0 +1,92 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "block/terracotta", + "1": "block/gray_terracotta", + "particle": "block/terracotta" + }, + "elements": [ + { + "from": [6, 2, 6], + "to": [10, 3, 10], + "faces": { + "north": {"uv": [6, 13, 10, 14], "texture": "#0"}, + "east": {"uv": [6, 13, 10, 14], "texture": "#0"}, + "south": {"uv": [6, 13, 10, 14], "texture": "#0"}, + "west": {"uv": [6, 13, 10, 14], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#0"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#0"} + } + }, + { + "from": [6, 4, 6], + "to": [10, 5, 10], + "faces": { + "north": {"uv": [6, 11, 10, 12], "texture": "#0"}, + "east": {"uv": [6, 11, 10, 12], "texture": "#0"}, + "south": {"uv": [6, 11, 10, 12], "texture": "#0"}, + "west": {"uv": [6, 11, 10, 12], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#0"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#0"} + } + }, + { + "from": [7, 1, 7], + "to": [9, 6, 9], + "faces": { + "north": {"uv": [7, 11, 9, 16], "texture": "#1"}, + "east": {"uv": [7, 11, 9, 16], "texture": "#1"}, + "south": {"uv": [7, 11, 9, 16], "texture": "#1"}, + "west": {"uv": [7, 11, 9, 16], "texture": "#1"}, + "up": {"uv": [7, 7, 9, 9], "texture": "#1"}, + "down": {"uv": [7, 7, 9, 9], "texture": "#1"} + } + }, + { + "from": [6, 0, 6], + "to": [10, 1, 10], + "faces": { + "north": {"uv": [6, 15, 10, 16], "texture": "#0"}, + "east": {"uv": [6, 15, 10, 16], "texture": "#0"}, + "south": {"uv": [6, 15, 10, 16], "texture": "#0"}, + "west": {"uv": [6, 15, 10, 16], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#0"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "translation": [0, 5, -1] + }, + "thirdperson_lefthand": { + "translation": [0, 5, -1] + }, + "firstperson_righthand": { + "translation": [0, 5.75, 0] + }, + "firstperson_lefthand": { + "translation": [0, 5.75, 0] + }, + "ground": { + "translation": [0, 5, 0] + }, + "gui": { + "rotation": [25, 50, 0], + "translation": [0, 4, 0] + }, + "head": { + "translation": [0, 14.5, 0] + } + }, + "groups": [ + { + "name": "group", + "origin": [0, 0, 0], + "color": 0, + "nbt": "{}", + "armAnimationEnabled": false, + "children": [0, 1, 2, 3] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/block/coal_generator.json b/src/main/resources/assets/gtm/models/block/coal_generator.json new file mode 100644 index 0000000..b0a3667 --- /dev/null +++ b/src/main/resources/assets/gtm/models/block/coal_generator.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "gtm:block/coal_generator" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/block/oak_post.json b/src/main/resources/assets/gtm/models/block/oak_post.json new file mode 100644 index 0000000..6099457 --- /dev/null +++ b/src/main/resources/assets/gtm/models/block/oak_post.json @@ -0,0 +1,45 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "block/stripped_oak_log", + "1": "block/deepslate_bricks", + "2": "block/oak_planks", + "particle": "block/stripped_oak_log" + }, + "elements": [ + { + "from": [5, 0, 5], + "to": [11, 16, 11], + "faces": { + "north": {"uv": [0, 0, 6, 16], "texture": "#1"}, + "east": {"uv": [10, 0, 16, 16], "texture": "#1"}, + "south": {"uv": [0, 0, 6, 16], "texture": "#1"}, + "west": {"uv": [10, 0, 16, 16], "texture": "#1"}, + "up": {"uv": [2, 2, 8, 8], "texture": "#1"}, + "down": {"uv": [2, 2, 8, 8], "texture": "#1"} + } + }, + { + "from": [6, 16, 6], + "to": [10, 32, 10], + "faces": { + "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "south": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "west": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#2"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#2"} + } + } + ], + "groups": [ + { + "name": "VoxelShapes", + "origin": [0, 0, 0], + "color": 0, + "nbt": "{}", + "armAnimationEnabled": false, + "children": [0, 1] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/block/uranium_deepslate_ore.json b/src/main/resources/assets/gtm/models/block/uranium_deepslate_ore.json new file mode 100644 index 0000000..ae7521b --- /dev/null +++ b/src/main/resources/assets/gtm/models/block/uranium_deepslate_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "gtm:block/uranium_deepslate_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/block/uranium_ore.json b/src/main/resources/assets/gtm/models/block/uranium_ore.json new file mode 100644 index 0000000..a0cee5d --- /dev/null +++ b/src/main/resources/assets/gtm/models/block/uranium_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "gtm:block/uranium_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/item/clay_insulator.json b/src/main/resources/assets/gtm/models/item/clay_insulator.json new file mode 100644 index 0000000..441b8db --- /dev/null +++ b/src/main/resources/assets/gtm/models/item/clay_insulator.json @@ -0,0 +1,3 @@ +{ + "parent": "gtm:block/clay_insulator" +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/item/coal_generator.json b/src/main/resources/assets/gtm/models/item/coal_generator.json new file mode 100644 index 0000000..dddbfcb --- /dev/null +++ b/src/main/resources/assets/gtm/models/item/coal_generator.json @@ -0,0 +1,3 @@ +{ + "parent": "gtm:block/coal_generator" +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/item/oak_post.json b/src/main/resources/assets/gtm/models/item/oak_post.json new file mode 100644 index 0000000..3866d80 --- /dev/null +++ b/src/main/resources/assets/gtm/models/item/oak_post.json @@ -0,0 +1,3 @@ +{ + "parent": "gtm:block/oak_post" +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/item/uranium_deepslate_ore.json b/src/main/resources/assets/gtm/models/item/uranium_deepslate_ore.json new file mode 100644 index 0000000..ba56ea7 --- /dev/null +++ b/src/main/resources/assets/gtm/models/item/uranium_deepslate_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "gtm:block/uranium_deepslate_ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/models/item/uranium_ore.json b/src/main/resources/assets/gtm/models/item/uranium_ore.json new file mode 100644 index 0000000..3a06b75 --- /dev/null +++ b/src/main/resources/assets/gtm/models/item/uranium_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "gtm:block/uranium_ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/gtm/textures/block/coal_generator.png b/src/main/resources/assets/gtm/textures/block/coal_generator.png new file mode 100644 index 0000000..844ed06 Binary files /dev/null and b/src/main/resources/assets/gtm/textures/block/coal_generator.png differ diff --git a/src/main/resources/assets/gtm/textures/block/uranium_deepslate_ore.png b/src/main/resources/assets/gtm/textures/block/uranium_deepslate_ore.png new file mode 100644 index 0000000..8dd36bc Binary files /dev/null and b/src/main/resources/assets/gtm/textures/block/uranium_deepslate_ore.png differ diff --git a/src/main/resources/assets/gtm/textures/block/uranium_ore.png b/src/main/resources/assets/gtm/textures/block/uranium_ore.png new file mode 100644 index 0000000..5a970aa Binary files /dev/null and b/src/main/resources/assets/gtm/textures/block/uranium_ore.png differ diff --git a/src/main/resources/assets/gtm/textures/gui/coal_generator.png b/src/main/resources/assets/gtm/textures/gui/coal_generator.png new file mode 100644 index 0000000..e7e236f Binary files /dev/null and b/src/main/resources/assets/gtm/textures/gui/coal_generator.png differ diff --git a/src/main/resources/data/gtm/loot_tables/blocks/clay_insulator.json b/src/main/resources/data/gtm/loot_tables/blocks/clay_insulator.json new file mode 100644 index 0000000..38ddfac --- /dev/null +++ b/src/main/resources/data/gtm/loot_tables/blocks/clay_insulator.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "gtm:clay_insulator" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/gtm/loot_tables/blocks/coal_generator.json b/src/main/resources/data/gtm/loot_tables/blocks/coal_generator.json new file mode 100644 index 0000000..78957ce --- /dev/null +++ b/src/main/resources/data/gtm/loot_tables/blocks/coal_generator.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "gtm:coal_generator" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/gtm/loot_tables/blocks/oak_post.json b/src/main/resources/data/gtm/loot_tables/blocks/oak_post.json new file mode 100644 index 0000000..938e9c5 --- /dev/null +++ b/src/main/resources/data/gtm/loot_tables/blocks/oak_post.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "gtm:oak_post" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/gtm/loot_tables/blocks/uranium_deepslate_ore.json b/src/main/resources/data/gtm/loot_tables/blocks/uranium_deepslate_ore.json new file mode 100644 index 0000000..e384190 --- /dev/null +++ b/src/main/resources/data/gtm/loot_tables/blocks/uranium_deepslate_ore.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "gtm:uranium_deepslate_ore" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/gtm/loot_tables/blocks/uranium_ore.json b/src/main/resources/data/gtm/loot_tables/blocks/uranium_ore.json new file mode 100644 index 0000000..592f9ca --- /dev/null +++ b/src/main/resources/data/gtm/loot_tables/blocks/uranium_ore.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "gtm:uranium_ore" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/gtm/recipes/clay_insulator.json b/src/main/resources/data/gtm/recipes/clay_insulator.json new file mode 100644 index 0000000..d9d379e --- /dev/null +++ b/src/main/resources/data/gtm/recipes/clay_insulator.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " i ", + "TiT" + ], + "key": { + "i": { + "item": "minecraft:iron_ingot" + }, + "T": { + "item": "minecraft:terracotta" + } + }, + "result": { + "item": "gtm:clay_insulator", + "count": 8 + } +} + diff --git a/src/main/resources/data/gtm/recipes/coal_generator.json b/src/main/resources/data/gtm/recipes/coal_generator.json new file mode 100644 index 0000000..5ae82ce --- /dev/null +++ b/src/main/resources/data/gtm/recipes/coal_generator.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "###", + "#C#", + "###" + ], + "key": { + "#": { + "item": "minecraft:cobblestone" + }, + "C": { + "item": "minecraft:coal" + } + }, + "result": { + "item": "gtm:coal_generator", + "count": 1 + } +} + diff --git a/src/main/resources/data/gtm/worldgen/configured_feature/uranium_ore.json b/src/main/resources/data/gtm/worldgen/configured_feature/uranium_ore.json new file mode 100644 index 0000000..f75f901 --- /dev/null +++ b/src/main/resources/data/gtm/worldgen/configured_feature/uranium_ore.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:ore", + "config": { + "discard_chance_on_air_exposure": 0.0, + "size": 12, + "targets": [ + { + "state": { + "Name": "gtm:uranium_ore" + }, + "target": { + "predicate_type": "minecraft:tag_match", + "tag": "minecraft:stone_ore_replaceables" + } + }, + { + "state": { + "Name": "gtm:uranium_deepslate_ore" + }, + "target": { + "predicate_type": "minecraft:tag_match", + "tag": "minecraft:deepslate_ore_replaceables" + } + } + ] + } +} + diff --git a/src/main/resources/data/gtm/worldgen/placed_feature/uranium_ore.json b/src/main/resources/data/gtm/worldgen/placed_feature/uranium_ore.json new file mode 100644 index 0000000..dc543de --- /dev/null +++ b/src/main/resources/data/gtm/worldgen/placed_feature/uranium_ore.json @@ -0,0 +1,28 @@ +{ + "feature": "gtm:uranium_ore", + "placement": [ + { + "type": "minecraft:count", + "count": 20 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:height_range", + "height": { + "type": "minecraft:trapezoid", + "max_inclusive": { + "absolute": 70 + }, + "min_inclusive": { + "absolute": -24 + } + } + }, + { + "type": "minecraft:biome" + } + ] +} + diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json new file mode 100644 index 0000000..e31528e --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "gtm:clay_insulator", + "gtm:coal_generator", + "gtm:uranium_ore", + "gtm:uranium_deepslate_ore" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json b/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json new file mode 100644 index 0000000..f3650f7 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "gtm:uranium_ore", + "gtm:uranium_deepslate_ore" + ] +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..8e1f612 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,33 @@ +{ + "schemaVersion": 1, + "id": "gtm", + "version": "${version}", + "name": "Generic Tech Mod", + "description": "A generic tech mod for Fabric.", + "authors": [ + "TheClashFruit" + ], + "contact": { + "website": "https://modrinth.com/mod/generic-tech-mod", + "repo": "https://git.theclashfruit.me/TheClashFruit/GenericTechMod" + }, + "license": "MIT", + "icon": "assets/gtm/icon.png", + "environment": "*", + "entrypoints": { + "client": [ + "me.theclashfruit.gtm.client.GenericTechClient" + ], + "main": [ + "me.theclashfruit.gtm.GenericTech" + ] + }, + "mixins": [ + "gtm.mixins.json" + ], + "depends": { + "fabricloader": ">=0.14.19", + "fabric": "*", + "minecraft": "1.19.4" + } +} diff --git a/src/main/resources/gtm.mixins.json b/src/main/resources/gtm.mixins.json new file mode 100644 index 0000000..abb7916 --- /dev/null +++ b/src/main/resources/gtm.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "me.theclashfruit.gtm.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 + } +}