-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
c8edd6f
commit 0cad941
Showing
29 changed files
with
101 additions
and
183 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
### 4.1.0 | ||
### 4.2.0 | ||
|
||
- Add Support for Mekanism and Immersive Engineering ores | ||
- Rewrite Features to support complex features |
2 changes: 0 additions & 2 deletions
2
common/src/generated/resources/.cache/12b48ce80665160388e37efcbe6ffc9c320247a7
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
common/src/generated/resources/.cache/1d8aa9c5d04d534625d05e0315fa2dfc314eb45b
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
common/src/generated/resources/.cache/2a895680709e271705f445e2c6f6dbca16550c92
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
common/src/generated/resources/.cache/3803046a7d7b7ce0a060be8ae0299aa98c17094c
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
common/src/generated/resources/.cache/4b9da48b48cbb77fa11342e113f8c9a9cb9c99c1
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
common/src/generated/resources/.cache/e360e4cfe8a52d2933ccfa99feb357854d82856f
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
common/src/generated/resources/.cache/e579368e5ce100f0caf83470459223110b73fa16
This file was deleted.
Oops, something went wrong.
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
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
6 changes: 6 additions & 0 deletions
6
common/src/generated/resources/data/jamd/tags/worldgen/configured_feature/mining.json
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,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:ore_infested" | ||
] | ||
} |
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
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
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
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
20 changes: 11 additions & 9 deletions
20
common/src/main/java/com/unrealdinnerbone/jamd/api/FeatureTypeRegistry.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 |
---|---|---|
@@ -1,30 +1,32 @@ | ||
package com.unrealdinnerbone.jamd.api; | ||
|
||
import com.unrealdinnerbone.trenzalore.api.platform.Services; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.*; | ||
import java.util.function.Supplier; | ||
|
||
public class FeatureTypeRegistry { | ||
private static final Logger LOGGER = LogManager.getLogger(); | ||
public static final List<IFeatureTypeCompact<?>> FEATURES = new ArrayList<>(); | ||
public static final Map<ResourceLocation, IFeatureTypeCompact<?>> FEATURES = new HashMap<>(); | ||
|
||
public static void register(String modId, Supplier<IFeatureTypeCompact<?>> featureTypeCompact) { | ||
public static void register(String modId, String id, Supplier<IFeatureTypeCompact<?>> featureTypeCompact) { | ||
register(modId, new ResourceLocation(modId, id), featureTypeCompact); | ||
} | ||
public static void register(String modId, ResourceLocation id, Supplier<IFeatureTypeCompact<?>> featureTypeCompact) { | ||
if (Services.PLATFORM.isModLoaded(modId)) { | ||
IFeatureTypeCompact<?> iFeatureTypeCompact = featureTypeCompact.get(); | ||
LOGGER.debug("Registering Feature {} for {}", iFeatureTypeCompact.getFeatureType(), modId); | ||
FEATURES.add(iFeatureTypeCompact); | ||
LOGGER.debug("Registering Feature {} for {}", id, modId); | ||
FEATURES.put(id, iFeatureTypeCompact); | ||
} else { | ||
LOGGER.debug("Skipping Feature for {} as mod is not loaded", modId); | ||
} | ||
} | ||
|
||
public static Optional<IFeatureTypeCompact<?>> getFeatureType(String id) { | ||
return FEATURES.stream().filter(featureTypeCompact -> featureTypeCompact.getFeatureType().toString().equalsIgnoreCase(id)).findFirst(); | ||
public static Optional<IFeatureTypeCompact<?>> getFeatureType(ResourceLocation id) { | ||
return Optional.ofNullable(FEATURES.get(id)); | ||
} | ||
|
||
} |
24 changes: 3 additions & 21 deletions
24
common/src/main/java/com/unrealdinnerbone/jamd/api/IFeatureTypeCompact.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 |
---|---|---|
@@ -1,40 +1,22 @@ | ||
package com.unrealdinnerbone.jamd.api; | ||
|
||
import com.google.gson.JsonObject; | ||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.DataResult; | ||
import com.mojang.serialization.JsonOps; | ||
import com.unrealdinnerbone.jamd.OresCodec; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; | ||
import net.minecraft.world.level.levelgen.placement.PlacementModifier; | ||
|
||
import java.util.List; | ||
|
||
public interface IFeatureTypeCompact<T> { | ||
|
||
default OresCodec getOreCodec(JsonObject config, List<PlacementModifier> modifiers) throws IllegalArgumentException { | ||
DataResult<T> parse = getCodec().parse(JsonOps.INSTANCE, config); | ||
if (parse.error().isPresent()) { | ||
throw new IllegalArgumentException(parse.error().get().message()); | ||
} else { | ||
return parse(parse.result().get(), modifiers); | ||
} | ||
default OresCodec getOreCodec(FeatureConfiguration feature, List<PlacementModifier> modifiers) throws IllegalArgumentException { | ||
return parse((T) feature, modifiers); | ||
} | ||
|
||
/** | ||
* @return The ore config codec | ||
*/ | ||
Codec<T> getCodec(); | ||
|
||
/** | ||
* @param value the parsed ore config codec | ||
* @param placementModifiers the placement modifiers to create ore codec | ||
* @return the ore codec | ||
*/ | ||
OresCodec parse(T value, List<PlacementModifier> placementModifiers); | ||
|
||
/** | ||
* @return feature type id | ||
*/ | ||
ResourceLocation getFeatureType(); | ||
} |
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
30 changes: 0 additions & 30 deletions
30
common/src/main/java/com/unrealdinnerbone/jamd/compact/MinecraftScatteredOre.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.