Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build
# other
eclipse
run
test-modpack/
.DS_Store

# Idk what prompted gradle to create this folder
Expand Down
23 changes: 9 additions & 14 deletions Common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ repositories {
mavenCentral()
mavenLocal()

maven { url 'https://maven.blamejared.com' }

maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
Expand All @@ -24,27 +22,24 @@ repositories {
}

maven { url "https://maven.shedaniel.me/" }
// accessories
maven { url 'https://maven.wispforest.io/releases' }
// EMI
maven { url = "https://maven.terraformersmc.com/releases/" }
}

def localM2 = new File(System.getProperty("user.home"), ".m2/repository")
def localM2Jar = { String relPath ->
files(new File(localM2, relPath.replace('/', File.separator)))
}

dependencies {
// === MANDATORY DEPS ===
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
// which get remapped to the correct annotations on each platform.
// Do NOT use other classes from Fabric Loader.
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
modImplementation localM2Jar("net/fabricmc/fabric-loader/${rootProject.fabric_loader_version}/fabric-loader-${rootProject.fabric_loader_version}.jar")

modCompileOnly "libs:paucal:$paucalVersion+$minecraftVersion-common"
// i do not know why the xplat and mod jars are in different coordinates
modCompileOnly "vazkii.patchouli:Patchouli-xplat:1.21-$patchouliVersion-SNAPSHOT"
modCompileOnly "com.samsthenerd.inline:inline-common:1.21.1-1.2.2-74"

// === OPTIONAL DEPS ===
modCompileOnly "dev.emi:emi-xplat-intermediary:${emiVersion}:api"
modCompileOnly "io.wispforest:accessories-common:$accessoriesVersion"
// Lock flaky BlameJared-hosted artifacts to local Maven copies for reproducible builds.
modCompileOnly localM2Jar("vazkii/patchouli/Patchouli-xplat/1.21.1-${patchouliVersion}/Patchouli-xplat-1.21.1-${patchouliVersion}.jar")
modCompileOnly localM2Jar("com/samsthenerd/inline/inline-common/1.21.1-1.2.2-74/inline-common-1.21.1-1.2.2-74.jar")

// === OTHER STUFF ===
compileOnly "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
Expand Down
1,335 changes: 1,335 additions & 0 deletions Common/src/main/resources/assets/hexcasting/lang/en_us.json

Large diffs are not rendered by default.

1,317 changes: 1,317 additions & 0 deletions Common/src/main/resources/assets/hexcasting/lang/ru_ru.json

Large diffs are not rendered by default.

1,330 changes: 1,330 additions & 0 deletions Common/src/main/resources/assets/hexcasting/lang/zh_cn.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Common/src/main/resources/hexplat.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ accessible field net/minecraft/client/renderer/RenderType$CompositeState texture
accessible class net/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard
accessible class net/minecraft/world/item/crafting/Ingredient$Value
accessible method net/minecraft/world/item/crafting/Ingredient <init> (Ljava/util/stream/Stream;)V
#accessible method net/minecraft/world/item/context/UseOnContext <init> (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V
#accessible method net/minecraft/world/damagesource/DamageSources source (Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/damagesource/DamageSource;
#accessible method net/minecraft/world/damagesource/DamageSources source (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/world/damagesource/DamageSource;
accessible method net/minecraft/world/item/context/UseOnContext <init> (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V
accessible method net/minecraft/world/damagesource/DamageSources source (Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/damagesource/DamageSource;
accessible method net/minecraft/world/damagesource/DamageSources source (Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/world/damagesource/DamageSource;
39 changes: 10 additions & 29 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,18 @@ plugins {
id 'com.gradleup.shadow'
}

def isNeoForgeOnlyInvocation = gradle.startParameter.taskNames
&& gradle.startParameter.taskNames.every { it == ":Neoforge" || it.startsWith(":Neoforge:") || it == "Neoforge" || it.startsWith("Neoforge:") }

if (isNeoForgeOnlyInvocation) {
return
}

architectury {
platformSetupLoomIde()
fabric()
}

// FIXME: update dependencies/versions before releasing 0.12
pkSubproj {
pkPublish = true
curseforgeJar = remapJar.archiveFile
curseforgeDependencies([
"paucal",
"patchouli",
"fabric-language-kotlin",
"inline",
"cloth-config",
"cardinal-components-api",
"fabric-api",
])
modrinthJar = remapJar.archiveFile
modrinthDependencies([
"paucal:dabyDTwJ", // 0.6.0-fabric
"patchouli:1.20.1-80-fabric",
"fabric-language-kotlin:1.9.4+kotlin.1.8.21",
"inline:1.20.1-1.0.1-fabric",
"cloth-config:11.1.106+fabric",
"cardinal-components-api:5.2.1",
"fabric-api:0.84.0+1.20.1",
])
}


loom {
mixin.defaultRefmapName = "hexcasting.mixins.refmap.json"

Expand Down Expand Up @@ -130,7 +111,7 @@ dependencies {
// === MANDATORY DEPS ===
modImplementation("libs:paucal:$paucalVersion+$minecraftVersion-fabric")
// dear mod devs, don't put the platform in the middle of your version code
modImplementation "vazkii.patchouli:Patchouli:1.21-$patchouliVersion-FABRIC-SNAPSHOT"
modImplementation "vazkii.patchouli:Patchouli:1.21.1-$patchouliVersion-FABRIC"
modImplementation "com.samsthenerd.inline:inline-fabric:$minecraftVersion-$inlineVersion"
modImplementation "io.wispforest:accessories-fabric:$accessoriesVersion"

Expand Down Expand Up @@ -166,7 +147,7 @@ dependencies {
// i am speed
// sodium is causing frustum mixin errors so don't use it
// modImplementation "maven.modrinth:sodium:${sodiumVersion}"
modImplementation "maven.modrinth:lithium:${lithiumVersion}-fabric"
// modImplementation "maven.modrinth:lithium:${lithiumVersion}"
// modImplementation "maven.modrinth:phosphor:${phosphorVersion}"


Expand Down Expand Up @@ -211,4 +192,4 @@ tasks.named('sourcesJar') {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

jar.finalizedBy(remapJar)
jar.finalizedBy(remapJar)
2 changes: 1 addition & 1 deletion Fabric/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ modmenuVersion=7.0.1

# Optimizations
sodiumVersion=mc1.20-0.4.10+build.27
lithiumVersion=mc1.21.1-0.15.1
lithiumVersion=E5eJVp4O
#phosphorVersion=mc1.19.x-0.8.1


72 changes: 20 additions & 52 deletions Neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ architectury {
neoForge()
}

// FIXME: update dependencies/versions before releasing 0.12
pkSubproj {
pkPublish = true
curseforgeJar = jar.archiveFile
curseforgeDependencies([
"paucal",
"patchouli",
"caelus",
"inline",
])
modrinthJar = jar.archiveFile
modrinthDependencies([
"paucal:HyBiJPtT", // 0.6.0-forge
"patchouli:1.20.1-80-forge",
"caelus:3.1.0+1.20",
"inline:1.20.1-1.0.1-forge",
])
}

configurations {
common {
canBeResolved = true
Expand Down Expand Up @@ -55,8 +36,6 @@ repositories {
}

maven { url = "https://maven.neoforged.net/releases/" }
// paucal and patchi
maven { url = 'https://maven.blamejared.com' }
maven {
name = "Curios"
url = uri("https://maven.theillusivec4.top/")
Expand All @@ -67,8 +46,6 @@ repositories {
}
// pehkui
maven { url = "https://jitpack.io" }
// EMI
maven { url = "https://maven.terraformersmc.com/releases/" }

maven {
name = 'Kotlin for Forge'
Expand All @@ -77,52 +54,43 @@ repositories {
}

maven { url "https://maven.shedaniel.me/" }
// accessories
maven { url 'https://maven.wispforest.io/releases' }
// sinytra connector or something?? accessories needs it
maven { url 'https://maven.su5ed.dev/releases' }
}

def localM2 = new File(System.getProperty("user.home"), ".m2/repository")
def localM2Jar = { String relPath ->
files(new File(localM2, relPath.replace('/', File.separator)))
}
def testModpackJar = { String jarName ->
files(rootProject.file("test-modpack/Create Aeronautica Create- Aeronautica/mods/${jarName}"))
}

dependencies {
neoForge "net.neoforged:neoforge:${neoforgeVersion}"
implementation(project(path: ':Common', configuration: 'namedElements')) { transitive false }
shadowBundle(project(path: ':Common', configuration: 'transformProductionNeoForge')) { transitive false }
modImplementation("thedarkcolour:kotlinforforge-neoforge:$kotlinForForgeVersion") {
exclude(group: "net.neoforged.fancymodloader", module: "loader")
}
modImplementation testModpackJar("kotlinforforge-5.11.0-all.jar")

// === MANDATORY DEPS ===

compileOnly("mezz.jei:jei-$minecraftVersion-neoforge-api:$jeiVersion")
runtimeOnly("mezz.jei:jei-$minecraftVersion-neoforge:$jeiVersion")
compileOnly testModpackJar("jei-1.21.1-neoforge-19.27.0.336.jar")
runtimeOnly testModpackJar("jei-1.21.1-neoforge-19.27.0.336.jar")

compileOnly("top.theillusivec4.curios:curios-neoforge:$curiosVersion+$minecraftVersion:api")
runtimeOnly("top.theillusivec4.curios:curios-neoforge:$curiosVersion+$minecraftVersion")
compileOnly testModpackJar("curios-neoforge-${curiosVersion}+${minecraftVersion}.jar")
runtimeOnly testModpackJar("curios-neoforge-${curiosVersion}+${minecraftVersion}.jar")

modImplementation "libs:paucal:$paucalVersion+$minecraftVersion-neoforge"
modImplementation "vazkii.patchouli:Patchouli:1.21-$patchouliVersion-NEOFORGE-SNAPSHOT"
modImplementation "com.illusivesoulworks.caelus:caelus-neoforge:$caelusVersion"
modImplementation "com.samsthenerd.inline:inline-neoforge:1.21.1-1.2.2-74"
modImplementation localM2Jar("vazkii/patchouli/Patchouli/1.21.1-${patchouliVersion}-NEOFORGE/Patchouli-1.21.1-${patchouliVersion}-NEOFORGE.jar")
modImplementation localM2Jar("com/illusivesoulworks/caelus/caelus-neoforge/${caelusVersion}/caelus-neoforge-${caelusVersion}.jar")
modImplementation localM2Jar("com/samsthenerd/inline/inline-neoforge/1.21.1-1.2.2-74/inline-neoforge-1.21.1-1.2.2-74.jar")
// needed for inline to run
modRuntimeOnly("me.shedaniel.cloth:cloth-config-forge:$clothConfigVersion")
modRuntimeOnly "com.samsthenerd.inline:inline-neoforge:$minecraftVersion-$inlineVersion"
modRuntimeOnly "dev.architectury:architectury-neoforge:$architecturyVersion"
modRuntimeOnly testModpackJar("cloth-config-15.0.140-neoforge.jar")
modRuntimeOnly localM2Jar("com/samsthenerd/inline/inline-neoforge/${minecraftVersion}-${inlineVersion}/inline-neoforge-${minecraftVersion}-${inlineVersion}.jar")
modRuntimeOnly testModpackJar("architectury-13.0.8-neoforge.jar")


// === OPTIONAL DEPS ===
modRuntimeOnly localM2Jar("com/github/Virtuoel/Pehkui/${pehkuiVersion}/Pehkui-${pehkuiVersion}.jar")

modCompileOnly "dev.emi:emi-neoforge:${emiVersion}:api"
modRuntimeOnly "dev.emi:emi-neoforge:${emiVersion}"
modImplementation "io.wispforest:accessories-neoforge:$accessoriesVersion"

modApi("com.github.Virtuoel:Pehkui:${pehkuiVersion}-1.21-neoforge")

// "Required due to issues with JIJ dependency resolving in arch or something"
// https://github.com/wisp-forest/accessories
forgeRuntimeLibrary("io.wispforest:endec:0.1.8")
forgeRuntimeLibrary("io.wispforest.endec:gson:0.1.5")
forgeRuntimeLibrary("io.wispforest.endec:netty:0.1.4")
forgeRuntimeLibrary("io.wispforest.endec:jankson:0.1.5")
forgeRuntimeLibrary("org.jetbrains.kotlin:kotlin-reflect:2.1.20")
forgeRuntimeLibrary("org.jetbrains.kotlin:kotlin-stdlib:2.1.20")
forgeRuntimeLibrary("org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.20")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@
import net.neoforged.neoforge.network.PacketDistributor;
import net.neoforged.neoforge.registries.NewRegistryEvent;
import net.neoforged.neoforge.registries.RegisterEvent;
import thedarkcolour.kotlinforforge.neoforge.KotlinModLoadingContext;

import java.util.function.BiConsumer;
import java.util.function.Consumer;

@Mod(HexAPI.MOD_ID)
public class ForgeHexInitializer {
private static IEventBus modEventBus;

public ForgeHexInitializer(ModContainer modContainer) {
modEventBus = modContainer.getEventBus();
initConfig(modContainer);
// workaround for Inline EntTypeCradles not being available on server, related to https://github.com/SamsTheNerd/inline/issues/34
EntTypeCradle.fromTypeId(ResourceLocation.fromNamespaceAndPath("minecraft", "pig")).get().getType();
Expand Down Expand Up @@ -294,6 +296,9 @@ private static void initListeners() {

// aaaauughhg
public static IEventBus getModEventBus() {
return KotlinModLoadingContext.Companion.get().getKEventBus();
if (modEventBus == null) {
throw new IllegalStateException("Hex mod event bus requested before mod construction");
}
return modEventBus;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.RegistryBuilder;
import org.jetbrains.annotations.Nullable;
import virtuoel.pehkui.api.ScaleTypes;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Optional;
import java.util.function.BiFunction;
Expand Down Expand Up @@ -545,18 +546,55 @@ public PehkuiInterop.ApiAbstraction getPehkuiApi() {
PEHKUI_API = new PehkuiInterop.ApiAbstraction() {
@Override
public float getScale(Entity e) {
return ScaleTypes.BASE.getScaleData(e).getScale();
return invokePehkuiScaleGetter(e);
}

@Override
public void setScale(Entity e, float scale) {
ScaleTypes.BASE.getScaleData(e).setScale(scale);
invokePehkuiScaleSetter(e, scale);
}
};
}
return PEHKUI_API;
}

private static float invokePehkuiScaleGetter(Entity entity) {
try {
Object scaleData = getPehkuiScaleData(entity);
Method getScale = scaleData.getClass().getMethod("getScale");
return ((Number) getScale.invoke(scaleData)).floatValue();
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("Failed to query Pehkui scale", e);
}
}

private static void invokePehkuiScaleSetter(Entity entity, float scale) {
try {
Object scaleData = getPehkuiScaleData(entity);
Method setScale = scaleData.getClass().getMethod("setScale", float.class);
setScale.invoke(scaleData, scale);
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("Failed to update Pehkui scale", e);
}
}

private static Object getPehkuiScaleData(Entity entity) throws ReflectiveOperationException {
Class<?> scaleTypesClass = Class.forName("virtuoel.pehkui.api.ScaleTypes");
Field baseField = scaleTypesClass.getField("BASE");
Object baseScaleType = baseField.get(null);
Method getScaleData = findGetScaleDataMethod(baseScaleType.getClass(), entity.getClass());
return getScaleData.invoke(baseScaleType, entity);
}

private static Method findGetScaleDataMethod(Class<?> scaleTypeClass, Class<?> entityClass) throws NoSuchMethodException {
for (Method method : scaleTypeClass.getMethods()) {
if (method.getName().equals("getScaleData") && method.getParameterCount() == 1) {
return method;
}
}
throw new NoSuchMethodException("No compatible getScaleData method for " + entityClass.getName());
}

public static final String TAG_BRAINSWEPT = "hexcasting:brainswept";
public static final String TAG_SENTINEL_EXISTS = "hexcasting:sentinel_exists";
public static final String TAG_SENTINEL_GREATER = "hexcasting:sentinel_extends_range";
Expand Down
Loading