Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
9 changes: 7 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
compileOnly(libs.jetbrains.annotations)

testJarJar(testApi(libs.testframework.get()))
testApi(libs.testframework.get())

jarJar(api(forge.ldlib.get()))

Expand Down Expand Up @@ -30,6 +30,11 @@ dependencies {
compileOnly(variantOf(forge.create) { classifier("slim") })
compileOnly(forge.flywheel.forge.api)

// Create
compileOnly(forge.ponder)
compileOnly(variantOf(forge.create) { classifier("slim") })
compileOnly(forge.flywheel.forge.api)

// KJS
compileOnly(forge.bundles.kjs)

Expand Down Expand Up @@ -90,7 +95,7 @@ dependencies {
extraLocalRuntime(forge.trenzalore)
extraLocalRuntime(forge.curios)
// extraLocalRuntime(forge.worldstripper)
localRuntime(forge.cc.tweaked.forge.impl)
extraLocalRuntime(forge.cc.tweaked.forge.impl)

localRuntime(forge.bundles.kjs)

Expand Down
31 changes: 21 additions & 10 deletions gradle/forge.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,38 @@ configuration = "3.1.1-neoforge"
jei = "19.25.1.328"
rei = "16.0.799"
emi = "1.1.22+1.21.1"

ae2 = "19.2.8"

kubejs = "2101.7.2-build.336"
rhino = "2101.2.7-build.81"
architectury = "13.0.8"
clothconfig = "15.0.140"
create = "6.0.8-168"
ponder = "1.0.64"
flywheel = "1.0.5"

curios = "9.4.2+1.21.1"
kotlinforforge = "5.7.0"

journeyMapApi = "2.0.0-1.21.1-SNAPSHOT"
ftblibrary = "2101.1.30"
ftbteams = "2101.1.9"
ftbquests = "2101.1.21"
ftbchunks = "2101.1.14"
ccTweaked = "1.116.0"
resourcefullib = "3.0.12"

gamestages = "17.0.1"
bookshelf = "21.1.56"

ccTweaked = "1.116.0"

resourcefullib = "3.0.12"
# TODO update these once there's 1.21 versions
argonauts = "1.2.4"
# FIXME for some reason their maven only has versions up to 1.1.10? latest on modrinth is 1.1.13
heracles = "1.1.10"

create = "6.0.8-168"
ponder = "1.0.64"
flywheel = "1.0.5"

## modrinth maven ##
jade = "15.10.0+neoforge"
sodium = "mc1.21.1-0.6.13-neoforge"
Expand All @@ -46,7 +54,6 @@ journeyMap = "6383889"
spark = "6225208"
observable = "5733591"


[libraries]
ldlib = { module = "com.lowdragmc.ldlib:ldlib-neoforge-1.21.1", version.ref = "ldlib" }
registrate = { module = "com.tterrag.registrate:Registrate", version.ref = "registrate" }
Expand All @@ -63,16 +70,15 @@ rei-neoforge = { module = "me.shedaniel:RoughlyEnoughItems-neoforge", ver
emi = { module = "dev.emi:emi-neoforge", version.ref = "emi" }

ae2 = { module = "org.appliedenergistics:appliedenergistics2", version.ref = "ae2" }

kubejs = { module = "dev.latvian.mods:kubejs-neoforge", version.ref = "kubejs" }
rhino = { module = "dev.latvian.mods:rhino", version.ref = "rhino" }
architectury = { module = "dev.architectury:architectury-neoforge", version.ref = "architectury" }
clothconfig = { module = "me.shedaniel.cloth:cloth-config-neoforge", version.ref = "clothconfig" }
create = { module = "com.simibubi.create:create-1.21.1", version.ref = "create" }
ponder = { module = "net.createmod.ponder:Ponder-NeoForge-1.21.1", version.ref = "ponder"}
flywheel-forge-api = { module = "dev.engine-room.flywheel:flywheel-neoforge-api-1.21.1", version.ref = "flywheel"}
flywheel-forge = { module = "dev.engine-room.flywheel:flywheel-neoforge-1.21.1", version.ref = "flywheel"}

curios = { module = "top.theillusivec4.curios:curios-neoforge", version.ref = "curios" }
kotlinforforge = { module = "thedarkcolour:kotlinforforge-neoforge", version.ref = "kotlinforforge" }

journeymap-api = { module = "info.journeymap:journeymap-api-neoforge", version.ref = "journeyMapApi" }
ftblibrary = { module = "dev.ftb.mods:ftb-library-neoforge", version.ref = "ftblibrary" }
ftbteams = { module = "dev.ftb.mods:ftb-teams-neoforge", version.ref = "ftbteams" }
Expand All @@ -90,6 +96,11 @@ heracles = { module = "earth.terrarium.heracles:heracles-forge-1.20.1
# argonauts = { module = "earth.terrarium.odyssey_allies:odyssey_allies-neoforge-1.21.1`", version.ref = "argonauts" }
# heracles = { module = "earth.terrarium.odyssey_quests:odyssey_quests-neoforge-1.21.1", version.ref = "heracles" }

create = { module = "com.simibubi.create:create-1.21.1", version.ref = "create" }
ponder = { module = "net.createmod.ponder:Ponder-NeoForge-1.21.1", version.ref = "ponder" }
flywheel-forge-api = { module = "dev.engine-room.flywheel:flywheel-neoforge-api-1.21.1", version.ref = "flywheel" }
flywheel-forge = { module = "dev.engine-room.flywheel:flywheel-neoforge-1.21.1", version.ref = "flywheel" }

jade = { module = "maven.modrinth:jade", version.ref = "jade" }
sodium = { module = "maven.modrinth:sodium", version.ref = "sodium" }
iris = { module = "maven.modrinth:iris", version.ref = "iris" }
Expand Down
8 changes: 0 additions & 8 deletions gradle/scripts/jars.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ java {
withSourcesJar()
}

// Use delombok'd files for sources
sourcesJar {
exclude {
sourceSets.main.allSource.contains it.file
}
from delombok
}

base {
archivesName = "${project.name}-${libs.versions.minecraft.get()}"
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gregtechceu/gtceu/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) {
MODID_KUBEJS = "kubejs",
MODID_IRIS = "iris",
MODID_SODIUM = "sodium",
MODID_CREATE = "create",
MODID_CURIOS = "curios",
MODID_MODERNFIX = "modernfix",
MODID_JOURNEYMAP = "journeymap",
Expand All @@ -133,8 +134,7 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) {
MODID_HERACLES = "heracles",
MODID_GAMESTAGES = "gamestages",
MODID_FTB_QUEST = "ftbquests",
MODID_CCTWEAKED = "computercraft",
MODID_CREATE = "create";
MODID_CCTWEAKED = "computercraft";

/**
* Spray painting compat modids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ static boolean doesCoverCollide(Direction side, List<VoxelShape> collisionBox, d

@Nullable
static Direction rayTraceCoverableSide(ICoverable coverable, Player player) {
HitResult rayTrace = ToolHelper.getPlayerDefaultRaytrace(player);
BlockHitResult rayTrace = ToolHelper.getPlayerDefaultRaytrace(player);
if (rayTrace.getType() != HitResult.Type.BLOCK) {
return null;
}
return traceCoverSide((BlockHitResult) rayTrace);
return traceCoverSide(rayTrace);
}

default boolean hasDynamicCovers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import dev.latvian.mods.rhino.util.HideFromJS;
import dev.latvian.mods.rhino.util.RemapPrefixForJS;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
Expand Down Expand Up @@ -564,7 +565,7 @@ public int hashCode() {
return Objects.hashCode(this.getResourceLocation());
}

@SuppressWarnings("UnusedReturnValue")
@SuppressWarnings({ "UnusedReturnValue", "unused" }) // API, need to treat all of these as used
@RemapPrefixForJS("kjs$")
public static class Builder {

Expand Down Expand Up @@ -1835,6 +1836,7 @@ public Builder addDefaultEnchant(ResourceKey<Enchantment> enchant, int level) {
*
* @return The finalized Material.
*/
@HideFromJS
public Material buildAndRegister() {
materialInfo.componentList = composition.isEmpty() && this.compositionSupplier != null ?
ImmutableList.copyOf(compositionSupplier.stream().map(MaterialStackWrapper::toMatStack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ public ArmorProperty.Builder protectionValues(Map<ArmorItem.Type, Integer> prote
return this;
}

/**
* Set an Ingredient to use as the repair ingredient when repairing armors made of this Material in an Anvil.
*/
public ArmorProperty.Builder repairIngredient(@Nullable Supplier<Ingredient> repairIngredient) {
if (repairIngredient == null) {
armorProperty.repairIngredient = () -> null;
Expand Down Expand Up @@ -216,10 +219,16 @@ public ArmorProperty.Builder dyeable(boolean dyeable) {
return this;
}

/**
* Set the texture layers for armor made of this Material.
*/
public ArmorProperty.Builder layers(ArmorMaterial.Layer... layers) {
return layers(Arrays.asList(layers));
}

/**
* Set the texture layers for armor made of this Material.
*/
public ArmorProperty.Builder layers(List<ArmorMaterial.Layer> layers) {
armorProperty.layers = layers;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public class ToolProperty implements IMaterialProperty {
/**
* Enchantment to be applied to tools made from this Material.
*/
@Getter
private final Object2IntMap<ResourceKey<Enchantment>> enchantments = new Object2IntArrayMap<>();

public ToolProperty(float harvestSpeed, float attackDamage, int durability, int harvestLevel, GTToolType[] types) {
Expand All @@ -141,10 +142,6 @@ public ToolProperty() {
this(1.0F, 1.0F, 100, 2, GTToolType.getTypes().values().toArray(GTToolType[]::new));
}

public Object2IntMap<ResourceKey<Enchantment>> getEnchantments() {
return enchantments;
}

@Override
public void verifyProperty(MaterialProperties properties) {
if (!properties.hasProperty(PropertyKey.WOOD)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gregtechceu.gtceu.data.pack.event;
package com.gregtechceu.gtceu.api.data.pack.event;

import net.neoforged.bus.api.Event;
import net.neoforged.fml.event.IModBusEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright 2022 QuiltMC
* Modified by the Steam 'n' Rails (Railways) team
*
* 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
*
* http://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.
*/
package com.gregtechceu.gtceu.api.datafixer;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.config.ConfigHolder;

import net.minecraft.SharedConstants;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.datafix.DataFixers;

import com.mojang.datafixers.DSL;
import com.mojang.datafixers.DataFixUtils;
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.serialization.Dynamic;
import org.jetbrains.annotations.*;

import java.util.function.BiFunction;

import static com.google.common.base.Preconditions.checkArgument;

@ApiStatus.Internal
public abstract class DataFixesInternals {

public static final BiFunction<Integer, Schema, Schema> BASE_SCHEMA = (version, parent) -> {
checkArgument(version == 0, "version must be 0");
checkArgument(parent == null, "parent must be null");
return get().createBaseSchema();
};

public record DataFixerEntry(DataFixer dataFixer, int currentVersion) {}

@Contract(pure = true)
@Range(from = 0, to = Integer.MAX_VALUE)
public static int getModDataVersion(@NotNull Dynamic<?> compound) {
return compound.get("GTCEu_DataVersion").asInt(0);
}

private static DataFixesInternals instance;

public static @NotNull DataFixesInternals get() {
if (instance == null) {
// Init config in case it's not loaded yet
ConfigHolder.init();
if (!ConfigHolder.INSTANCE.compat.doDatafixers) {
instance = new NoOpDataFixesInternals();
return instance;
}

Schema latestVanillaSchema;
try {
latestVanillaSchema = DataFixers.getDataFixer()
.getSchema(DataFixUtils
.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion()));
} catch (Exception e) {
latestVanillaSchema = null;
}

if (latestVanillaSchema == null) {
GTCEu.LOGGER.warn("[GTCEuM DFU] Failed to initialize! Either someone stopped DFU from initializing,");
GTCEu.LOGGER.warn("[GTCEuM DFU] or this Minecraft build is hosed.");
GTCEu.LOGGER.warn("[GTCEuM DFU] Using no-op implementation.");
instance = new NoOpDataFixesInternals();
} else {
instance = new DataFixesInternalsImpl(latestVanillaSchema);
}
}

return instance;
}

public abstract void registerFixer(@Range(from = 0, to = Integer.MAX_VALUE) int currentVersion,
@NotNull DataFixer dataFixer);

public abstract @Nullable DataFixerEntry getFixerEntry();

@Contract(value = "-> new", pure = true)
public abstract @NotNull Schema createBaseSchema();

public abstract @NotNull <T> Dynamic<T> updateWithAllFixers(DSL.TypeReference dataFixTypes,
@NotNull Dynamic<T> dynamic);

public abstract @NotNull CompoundTag addModDataVersions(@NotNull CompoundTag compound);
}
Loading
Loading