generated from NeoForgeMDKs/MDK-1.21.1-ModDevGradle
-
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.
refactor code: removed unused lines of code + refactor gradle.properties
- Loading branch information
Showing
11 changed files
with
33 additions
and
116 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,15 @@ | ||
package net.enderio.capacitoradditions; | ||
|
||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.Item; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.fml.event.config.ModConfigEvent; | ||
import net.neoforged.neoforge.common.ModConfigSpec; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
// An example config class. This is not required, but it's a good idea to have one to keep your config organized. | ||
// Demonstrates how to use Neo's config APIs | ||
@EventBusSubscriber(modid = CapacitorAdditions.MOD_ID, bus = EventBusSubscriber.Bus.MOD) | ||
public class Config | ||
{ | ||
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); | ||
|
||
private static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER | ||
.comment("Whether to log the dirt block on common setup") | ||
.define("logDirtBlock", true); | ||
|
||
private static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER | ||
.comment("A magic number") | ||
.defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); | ||
|
||
public static final ModConfigSpec.ConfigValue<String> MAGIC_NUMBER_INTRODUCTION = BUILDER | ||
.comment("What you want the introduction message to be for the magic number") | ||
.define("magicNumberIntroduction", "The magic number is... "); | ||
|
||
// a list of strings that are treated as resource locations for items | ||
private static final ModConfigSpec.ConfigValue<List<? extends String>> ITEM_STRINGS = BUILDER | ||
.comment("A list of items to log on common setup.") | ||
.defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); | ||
|
||
static final ModConfigSpec SPEC = BUILDER.build(); | ||
|
||
public static boolean logDirtBlock; | ||
public static int magicNumber; | ||
public static String magicNumberIntroduction; | ||
public static Set<Item> items; | ||
|
||
private static boolean validateItemName(final Object obj) | ||
{ | ||
return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName)); | ||
} | ||
|
||
@SubscribeEvent | ||
static void onLoad(final ModConfigEvent event) | ||
{ | ||
logDirtBlock = LOG_DIRT_BLOCK.get(); | ||
magicNumber = MAGIC_NUMBER.get(); | ||
magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); | ||
|
||
// convert the list of strings into a set of items | ||
items = ITEM_STRINGS.get().stream() | ||
.map(itemName -> BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemName))) | ||
.collect(Collectors.toSet()); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/capacitatoradditions/models/item/unobtainium_capacitor.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 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "capacitatoradditions:item/unobtainium_capacitor" | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
src/main/resources/assets/capacitatoradditions/models/item/unobtanium_capacitor.json
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