Skip to content

Commit

Permalink
feat: functions and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 23, 2024
1 parent 3a206f6 commit d0b6e11
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/main/java/net/zepalesque/zenith/Zenith.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import net.neoforged.neoforge.registries.DataPackRegistryEvent;
import net.zepalesque.zenith.api.condition.Condition;
import net.zepalesque.zenith.api.condition.ConditionElements;
Expand Down Expand Up @@ -51,6 +52,14 @@ public Zenith(IEventBus bus, Dist dist) {
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ZConfig.COMMON_SPEC, MODID + "/common.toml");
}









private void commonSetup(final FMLCommonSetupEvent event) {

}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/zepalesque/zenith/config/ZConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static class Common {
public Common(ModConfigSpec.Builder builder) {
builder.push("TODO");
placeholder = builder
.comment("Temporary placeholder config")
.define("placeholder", true);
.comment("Temporary placeholder config, used")
.define("Placeholder Config", true);
builder.pop();
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/net/zepalesque/zenith/util/DataGenUtil.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package net.zepalesque.zenith.util;

import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import net.neoforged.neoforge.registries.DeferredHolder;
import org.codehaus.plexus.util.StringUtils;

import java.util.function.Supplier;

public class DataGenUtil {
public class DatagenUtil {

public static <T> ResourceLocation getId(Supplier<? extends T> object, Registry<T> registry) {
return registry.getKey(object.get());
Expand All @@ -22,4 +20,8 @@ public static String getNameLocalized(String id) {
public static <T> String getNameLocalized(Supplier<? extends T> object, Registry<T> registry) {
return getNameLocalized(getId(object, registry).getPath());
}

public static <T> String getNameLocalized(DeferredHolder<?, ?> holder) {
return getNameLocalized(holder.getId().getPath());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.zepalesque.zenith.util.lambda.consumer;

/**
* An operation that accepts six upper arguments and returns no result.
*
* @param <K> type of the first argument
* @param <V> type of the second argument
* @param <S> type of the third argument
* @param <T> type of the fourth argument
* @param <R> type of the fifth argument
* @param <Y> type of the sixth argument
*
*/
public interface HexConsumer<K, V, S, T, R, Y> {

/**
* Performs the operation given the specified arguments.
* @param k the first upper argument
* @param v the second upper argument
* @param s the third upper argument
* @param t the fourth upper argument
* @param r the fifth upper argument
* @param y the sixth upper argument
*/
void accept(K k, V v, S s, T t, R r, Y y);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.zepalesque.zenith.util.lambda.consumer;

/**
* An operation that accepts four upper arguments and returns no result.
*
* @param <K> type of the first argument
* @param <V> type of the second argument
* @param <S> type of the third argument
* @param <T> type of the fourth argument
*/
public interface QuadConsumer<K, V, S, T> {

/**
* Performs the operation given the specified arguments.
* @param k the first upper argument
* @param v the second upper argument
* @param s the third upper argument
* @param t the fourth upper argument
*/
void accept(K k, V v, S s, T t);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.zepalesque.zenith.util.lambda.consumer;

/**
* An operation that accepts seven upper arguments and returns no result.
*
* @param <K> type of the first argument
* @param <V> type of the second argument
* @param <S> type of the third argument
* @param <T> type of the fourth argument
* @param <R> type of the fifth argument
* @param <Q> type of the sixth argument
* @param <L> type of the seventh argument
*/
public interface SeptConsumer<K, V, S, T, R, Q, L> {

/**
* Performs the operation given the specified arguments.
* @param k the first upper argument
* @param v the second upper argument
* @param s the third upper argument
* @param t the fourth upper argument
* @param r the fifth upper argument
* @param q the sixth upper argument
* @param l the seventh upper argument
*/
void accept(K k, V v, S s, T t, R r, Q q, L l);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.zepalesque.zenith.util.lambda.function;

/**
* An operation that accepts six upper arguments and returns a result.
*
* @param <K> type of the first argument
* @param <V> type of the second argument
* @param <S> type of the third argument
* @param <T> type of the fourth argument
* @param <R> type of the fifth argument
* @param <Y> type of the sixth argument
*
* @param <Z> type of the return value
*/
public interface HexFunction<K, V, S, T, R, Y, Z> {

/**
* Performs the operation given the specified arguments.
* @param k the first upper argument
* @param v the second upper argument
* @param s the third upper argument
* @param t the fourth upper argument
* @param r the fifth upper argument
* @param y the sixth upper argument
*/
Z apply(K k, V v, S s, T t, R r, Y y);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package net.zepalesque.zenith.util.lambda.function;

/**
* An operation that accepts eight upper arguments and returns a result.
*
* @param <K> type of the first argument
* @param <V> type of the second argument
* @param <S> type of the third argument
* @param <T> type of the fourth argument
* @param <R> type of the fifth argument
* @param <Q> type of the sixth argument
* @param <L> type of the seventh argument
* @param <X> type of the eighth argument
*
* @param <Z> type of the return value
*/
public interface OctoFunction<K, V, S, T, R, Q, L, X, Z> {

/**
* Performs the operation given the specified arguments.
* @param k the first upper argument
* @param v the second upper argument
* @param s the third upper argument
* @param t the fourth upper argument
* @param r the fifth upper argument
* @param q the sixth upper argument
* @param l the seventh upper argument
* @param x the eighth upper argument
*/
Z apply(K k, V v, S s, T t, R r, Q q, L l, X x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.zepalesque.zenith.util.lambda.function;

/**
* An operation that accepts four upper arguments and returns a result.
*
* @param <K> type of the first argument
* @param <V> type of the second argument
* @param <S> type of the third argument
* @param <T> type of the fourth argument
* @param <R> type of the result
*/
public interface QuadFunction<K, V, S, T, R> {

/**
* Performs the operation given the specified arguments.
* @param k the first upper argument
* @param v the second upper argument
* @param s the third upper argument
* @param t the fourth upper argument
*/
R apply(K k, V v, S s, T t);
}

0 comments on commit d0b6e11

Please sign in to comment.