-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 49a8574
Showing
861 changed files
with
19,572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Disable autocrlf on generated files, they always generate with LF | ||
# Add any extra files or paths here to make git stop saying they | ||
# are changed when only line endings change. | ||
src/generated/**/.cache/cache text eol=lf | ||
src/generated/**/*.json text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# eclipse | ||
bin | ||
*.launch | ||
.settings | ||
.metadata | ||
.classpath | ||
.project | ||
|
||
# idea | ||
out | ||
*.ipr | ||
*.iws | ||
*.iml | ||
.idea | ||
|
||
# gradle | ||
build | ||
.gradle | ||
|
||
# other | ||
eclipse | ||
run | ||
|
||
# Files from Forge MDK | ||
forge*changelog.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
buildscript { | ||
repositories { | ||
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below | ||
maven { url = 'https://maven.minecraftforge.net' } | ||
jcenter() | ||
mavenCentral() | ||
maven { name="sponge"; url 'https://repo.spongepowered.org/repository/maven-public/' } | ||
} | ||
dependencies { | ||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true | ||
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' | ||
} | ||
} | ||
apply plugin: 'net.minecraftforge.gradle' | ||
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. | ||
apply plugin: 'eclipse' | ||
apply plugin: 'maven-publish' | ||
|
||
apply plugin: 'org.spongepowered.mixin' | ||
|
||
version = '1.0' | ||
group = 'com.hexagram2021.emeraldcraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html | ||
archivesBaseName = 'emeraldcraft' | ||
|
||
// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. | ||
java.toolchain.languageVersion = JavaLanguageVersion.of(16) | ||
|
||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) | ||
minecraft { | ||
// The mappings can be changed at any time and must be in the following format. | ||
// Channel: Version: | ||
// snapshot YYYYMMDD Snapshot are built nightly. | ||
// stable # Stables are built at the discretion of the MCP team. | ||
// official MCVersion Official field/method names from Mojang mapping files | ||
// | ||
// You must be aware of the Mojang license when using the 'official' mappings. | ||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md | ||
// | ||
// Use non-default mappings at your own risk. They may not always work. | ||
// Simply re-run your setup task after changing the mappings to update your workspace. | ||
mappings channel: 'official', version: '1.17.1' | ||
|
||
//accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') | ||
|
||
// Default run configurations. | ||
// These can be tweaked, removed, or duplicated as needed. | ||
runs { | ||
client { | ||
workingDirectory project.file('run') | ||
|
||
// Recommended logging data for a userdev environment | ||
// The markers can be added/remove as needed separated by commas. | ||
// "SCAN": For mods scan. | ||
// "REGISTRIES": For firing of registry events. | ||
// "REGISTRYDUMP": For getting the contents of all registries. | ||
property 'forge.logging.markers', 'REGISTRIES' | ||
property 'mixin.env.remapRefMap', 'true' | ||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" | ||
|
||
// Recommended logging level for the console | ||
// You can set various levels here. | ||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels | ||
property 'forge.logging.console.level', 'debug' | ||
arg "-mixin.config=emeraldcraft.mixins.json" | ||
|
||
mods { | ||
emeraldcraft { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
|
||
server { | ||
workingDirectory project.file('run') | ||
|
||
// Recommended logging data for a userdev environment | ||
// The markers can be added/remove as needed separated by commas. | ||
// "SCAN": For mods scan. | ||
// "REGISTRIES": For firing of registry events. | ||
// "REGISTRYDUMP": For getting the contents of all registries. | ||
property 'forge.logging.markers', 'REGISTRIES' | ||
property 'mixin.env.remapRefMap', 'true' | ||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" | ||
|
||
// Recommended logging level for the console | ||
// You can set various levels here. | ||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels | ||
property 'forge.logging.console.level', 'debug' | ||
arg "-mixin.config=emeraldcraft.mixins.json" | ||
|
||
mods { | ||
emeraldcraft { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
|
||
data { | ||
workingDirectory project.file('run') | ||
|
||
// Recommended logging data for a userdev environment | ||
// The markers can be added/remove as needed separated by commas. | ||
// "SCAN": For mods scan. | ||
// "REGISTRIES": For firing of registry events. | ||
// "REGISTRYDUMP": For getting the contents of all registries. | ||
property 'forge.logging.markers', 'REGISTRIES' | ||
property 'mixin.env.remapRefMap', 'true' | ||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" | ||
|
||
// Recommended logging level for the console | ||
// You can set various levels here. | ||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels | ||
property 'forge.logging.console.level', 'debug' | ||
|
||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. | ||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') | ||
arg "-mixin.config=emeraldcraft.mixins.json" | ||
|
||
mods { | ||
emeraldcraft { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Include resources generated by data generators. | ||
sourceSets.main.resources { srcDir 'src/generated/resources' } | ||
|
||
repositories { | ||
// Put repositories for dependencies here | ||
// ForgeGradle automatically adds the Forge maven and Maven Central for you | ||
|
||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so: | ||
// flatDir { | ||
// dir 'libs' | ||
// } | ||
maven { // TOP | ||
url "https://cursemaven.com" | ||
} | ||
maven { // JEI | ||
name 'DVS1 Maven FS' | ||
url 'https://dvs1.progwml6.com/files/maven' | ||
} | ||
maven { //mirror | ||
name = "ModMaven" | ||
url = "https://modmaven.dev" | ||
} | ||
} | ||
|
||
dependencies { | ||
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed | ||
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. | ||
// The userdev artifact is a special name and will get all sorts of transformations applied to it. | ||
minecraft 'net.minecraftforge:forge:1.17.1-37.1.1' | ||
|
||
// Real mod deobf dependency examples - these get remapped to your current mappings | ||
compileOnly fg.deobf("mezz.jei:jei-1.17.1:8.3.1.62:api") // Adds JEI API as a compile dependency | ||
|
||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' | ||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency | ||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency | ||
|
||
// Examples using mod jars from ./libs | ||
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") | ||
|
||
// For more info... | ||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html | ||
// http://www.gradle.org/docs/current/userguide/dependency_management.html | ||
} | ||
|
||
// Example for how to get properties into the manifest for reading at runtime. | ||
jar { | ||
manifest { | ||
attributes([ | ||
"Specification-Title" : "Emerald Craft Mod", | ||
"Specification-Vendor" : "Hexagram", | ||
"Specification-Version" : "1", // We are version 1 of ourselves | ||
"Implementation-Title" : project.name, | ||
"Implementation-Version" : project.jar.archiveVersion, | ||
"Implementation-Vendor" : "Hexagram", | ||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), | ||
'FMLCorePluginContainsFMLMod': 'true' | ||
]) | ||
} | ||
} | ||
|
||
// Example configuration to allow publishing using the maven-publish plugin | ||
// This is the preferred method to reobfuscate your jar file | ||
jar.finalizedBy('reobfJar') | ||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing | ||
// publish.dependsOn('reobfJar') | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifact jar | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url "file://${project.projectDir}/mcmodsrepo" | ||
} | ||
} | ||
} | ||
|
||
mixin { | ||
// MixinGradle Settings | ||
add sourceSets.main, 'emeraldcraft.refmap.json' | ||
config 'emeraldcraft.mixins.json' | ||
|
||
debug.verbose = true | ||
debug.export = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.hexgram2021.emeraldcraft.api; | ||
|
||
public class ECTags { | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/api/java/com/hexgram2021/emeraldcraft/api/crafting/ECRecipeSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.hexgram2021.emeraldcraft.api.crafting; | ||
|
||
import com.google.common.base.Preconditions; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.Recipe; | ||
import net.minecraft.world.item.crafting.RecipeSerializer; | ||
import net.minecraft.world.item.crafting.ShapedRecipe; | ||
import net.minecraftforge.common.crafting.CraftingHelper; | ||
import net.minecraftforge.registries.ForgeRegistryEntry; | ||
|
||
import java.util.function.Function; | ||
|
||
public abstract class ECRecipeSerializer <R extends Recipe<?>> extends ForgeRegistryEntry<RecipeSerializer<?>> implements RecipeSerializer<R> { | ||
public abstract ItemStack getIcon(); | ||
|
||
@Override | ||
public final R fromJson(ResourceLocation recipeId, JsonObject json) { | ||
if(CraftingHelper.processConditions(json, "conditions")) | ||
return readFromJson(recipeId, json); | ||
return null; | ||
} | ||
|
||
protected ItemStack readOutput(JsonElement outputObject) { | ||
if(outputObject.isJsonObject()&&outputObject.getAsJsonObject().has("item")) | ||
return ShapedRecipe.itemStackFromJson(outputObject.getAsJsonObject()); | ||
IngredientWithSize outgredient = IngredientWithSize.deserialize(outputObject); | ||
return getPreferredStack(outgredient.getMatchingStacks()); | ||
} | ||
|
||
private ItemStack getPreferredStack(ItemStack[] matchingStacks) { | ||
ItemStack preferredStack = null; | ||
Function<ItemStack, ResourceLocation> getName = stack -> stack.getItem().getRegistryName(); | ||
|
||
for(ItemStack stack : matchingStacks) | ||
{ | ||
ResourceLocation rl = getName.apply(stack); | ||
if(rl==null) | ||
continue; | ||
if(preferredStack==null) | ||
preferredStack = stack; | ||
else if(rl.compareTo(getName.apply(preferredStack)) < 0) | ||
preferredStack = stack; | ||
} | ||
Preconditions.checkNotNull(preferredStack, "No entry found in %s", matchingStacks); | ||
return preferredStack; | ||
} | ||
|
||
public abstract R readFromJson(ResourceLocation recipeId, JsonObject json); | ||
} |
72 changes: 72 additions & 0 deletions
72
src/api/java/com/hexgram2021/emeraldcraft/api/crafting/ECSerializableRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.hexgram2021.emeraldcraft.api.crafting; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.Container; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.Recipe; | ||
import net.minecraft.world.item.crafting.RecipeSerializer; | ||
import net.minecraft.world.item.crafting.RecipeType; | ||
import net.minecraft.world.level.Level; | ||
|
||
public abstract class ECSerializableRecipe implements Recipe<Container> { | ||
protected final ItemStack outputDummy; | ||
protected final RecipeType<?> type; | ||
protected final ResourceLocation id; | ||
|
||
protected ECSerializableRecipe(ItemStack outputDummy, RecipeType<?> type, ResourceLocation id) | ||
{ | ||
this.outputDummy = outputDummy; | ||
this.type = type; | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public boolean isSpecial() | ||
{ | ||
return true; | ||
} | ||
|
||
@Override | ||
public ItemStack getToastSymbol() | ||
{ | ||
return getECSerializer().getIcon(); | ||
} | ||
|
||
@Override | ||
public boolean matches(Container inv, Level worldIn) | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public ItemStack assemble(Container inv) | ||
{ | ||
return this.outputDummy; | ||
} | ||
|
||
@Override | ||
public boolean canCraftInDimensions(int width, int height) | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public ResourceLocation getId() | ||
{ | ||
return this.id; | ||
} | ||
|
||
@Override | ||
public RecipeSerializer<?> getSerializer() | ||
{ | ||
return getECSerializer(); | ||
} | ||
|
||
protected abstract ECRecipeSerializer<?> getECSerializer(); | ||
|
||
@Override | ||
public RecipeType<?> getType() | ||
{ | ||
return this.type; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/api/java/com/hexgram2021/emeraldcraft/api/crafting/IIngredientWithSizeSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.hexgram2021.emeraldcraft.api.crafting; | ||
|
||
import com.google.gson.JsonElement; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public interface IIngredientWithSizeSerializer { | ||
IngredientWithSize parse(@Nonnull FriendlyByteBuf buffer); | ||
void write(@Nonnull FriendlyByteBuf buffer, @Nonnull IngredientWithSize ingredient); | ||
IngredientWithSize parse(@Nonnull JsonElement json); | ||
JsonElement write(@Nonnull IngredientWithSize ingredient); | ||
} |
Oops, something went wrong.