Skip to content

Commit

Permalink
feat: it compiles, more testing and data gen to do
Browse files Browse the repository at this point in the history
  • Loading branch information
GoryMoon committed Dec 31, 2024
1 parent 6dfe3c3 commit 7750c03
Show file tree
Hide file tree
Showing 51 changed files with 1,008 additions and 823 deletions.
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.163'
id 'net.neoforged.gradle.userdev' version '7.0.176'
}

tasks.named('wrapper', Wrapper).configure {
Expand Down Expand Up @@ -112,8 +112,7 @@ dependencies {
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
implementation "net.neoforged:neoforge:${neo_version}"

localRuntime "top.theillusivec4.curios:curios-neoforge:${curios_version}"
compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api"
implementation "top.theillusivec4.curios:curios-neoforge:${curios_version}"

// localRuntime "io.codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal"
// localRuntime "com.brandon3055.draconicevolution:Draconic-Evolution:${minecraft_version}-3.1.2.588:universal"
Expand Down Expand Up @@ -155,9 +154,9 @@ tasks.withType(ProcessResources).configureEach {
mod_description : mod_description,

curios_version_range : curios_version_range,
if_version_range : if_version_range,/*
if_version_range : if_version_range,
bc_version_range : bc_version_range,
flux_version_range : flux_version_range*/
flux_version_range : flux_version_range
]
inputs.properties replaceProperties

Expand Down
22 changes: 11 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.daemon=false
org.gradle.debug=false

# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
neogradle.subsystems.parchment.minecraftVersion=1.21
neogradle.subsystems.parchment.mappingsVersion=2024.07.28
neogradle.subsystems.parchment.minecraftVersion=1.21.1
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
neogradle.subsystems.devLogin.enabled=true

# Environment Properties
minecraft_version=1.21.1
minecraft_version_range=[1.21,1.21.1)
neo_version=21.1.55
neo_version=21.1.92
neo_version_range=[21.1,)
loader_version_range=[4,)

Expand All @@ -26,19 +26,19 @@ mod_description=A mod that adds item charger blocks in tiers and a wireless one


# Dependencies
curios_version=9.0.10+1.21
curios_version_range=[9.0.10+1.21,)
curios_version=9.0.15+1.21.1
curios_version_range=[9.0.10+1.21.1,)

# ccl_version=4.4.0.+
# bc_version=3.2.1.+
# bc_version_range=[3.2.1.+,)
bc_version_range=[3.2.1.+,)

# Flux-Networks-1.20.1-7.2.1
# flux_version=5234697
# flux_version_range=[7.2,)
flux_version_range=[7.2,)

# industrialforegoing-1.21-3.6.10
if_version=5732195
if_version_range=[3.6.10,)
# titanium-1.21-4.0.21
titanium_version=5726400
if_version=6030556
if_version_range=[1.21-3.6.15,)
# titanium-1.21-4.0.30
titanium_version=5897690
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pluginManagement {
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
}

This file was deleted.

31 changes: 19 additions & 12 deletions src/main/java/se/gory_moon/chargers/ChargersMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import se.gory_moon.chargers.block.BlockRegistry;
import se.gory_moon.chargers.block.entity.BlockEntityRegistry;
import se.gory_moon.chargers.crafting.RecipeSerializers;
import se.gory_moon.chargers.data.ChargerLanguageProvider;
import se.gory_moon.chargers.data.*;
import se.gory_moon.chargers.handler.CapabilityRegistrationHandler;
import se.gory_moon.chargers.item.ChargerDataComponents;
import se.gory_moon.chargers.item.ItemRegistry;
import se.gory_moon.chargers.network.PacketHandler;
import se.gory_moon.chargers.network.PayloadRegister;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
Expand All @@ -33,23 +34,24 @@ public class ChargersMod {

public ChargersMod(IEventBus modBus, ModContainer container) {

modBus.addListener(this::setup);
modBus.addListener(this::buildTabContents);
modBus.addListener(this::gatherData);
modBus.addListener(PayloadRegister::onPayloadRegister);
modBus.addListener(CapabilityRegistrationHandler::registerCapabilities);

BlockRegistry.init();
BlockEntityRegistry.init();
ItemRegistry.init();
BlockRegistry.BLOCKS.register(modBus);;
BlockRegistry.BLOCK_TYPES.register(modBus);
BlockEntityRegistry.BlOCK_ENTITIES.register(modBus);
BlockEntityRegistry.MENU_TYPES.register(modBus);
ItemRegistry.ITEMS.register(modBus);
ItemRegistry.CREATIVE_TABS.register(modBus);
ChargerDataComponents.DATA_COMPONENTS.register(modBus);

RecipeSerializers.RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus());
RecipeSerializers.RECIPE_SERIALIZER.register(modBus);
container.registerConfig(ModConfig.Type.SERVER, Configs.serverSpec);
container.registerConfig(ModConfig.Type.COMMON, Configs.commonSpec);
}

private void setup(FMLCommonSetupEvent event) {
PacketHandler.init();
}

private void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
PackOutput packOutput = gen.getPackOutput();
Expand All @@ -63,6 +65,11 @@ private void gatherData(GatherDataEvent event) {
Optional.of(new InclusiveRange<>(0, Integer.MAX_VALUE)))));

gen.addProvider(event.includeClient(), new ChargerLanguageProvider(packOutput));
gen.addProvider(event.includeClient(), new ChargerBlockStateProvider(packOutput, existingFileHelper));
gen.addProvider(event.includeClient(), new ChargerItemModelProvider(packOutput, existingFileHelper));

gen.addProvider(event.includeServer(), new ChargerRecipeProvider(packOutput, lookupProvider));
gen.addProvider(event.includeServer(), new ChargerLootTableProvider(packOutput, lookupProvider));
}

public void buildTabContents(BuildCreativeModeTabContentsEvent event) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/se/gory_moon/chargers/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static class Common {
.push("compat");

curiosCompat = builder
.comment("If curios compat should be enabled")
.comment("If the wireless charger should charge curios items")
.define("curios_compat", true);

builder.pop(2);
Expand Down
21 changes: 2 additions & 19 deletions src/main/java/se/gory_moon/chargers/Constants.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
package se.gory_moon.chargers;

import net.minecraft.resources.ResourceLocation;

public class Constants {
public static final String MOD_ID = "chargers";

public static ResourceLocation NET_ID = ResourceLocation.fromNamespaceAndPath(MOD_ID, "net");

public static final String CHARGER_T1_BLOCK = "charger_t1";
public static final String CHARGER_T1_NAME = "Charger Tier I";

public static final String CHARGER_T2_BLOCK = "charger_t2";
public static final String CHARGER_T2_NAME = "Charger Tier II";

public static final String CHARGER_T3_BLOCK = "charger_t3";
public static final String CHARGER_T3_NAME = "Charger Tier III";

public static final String CHARGER_T4_BLOCK = "charger_t4";
public static final String CHARGER_T4_NAME = "Charger Tier IV";

public static final String CHARGER_CREATIVE_BLOCK = "charger_creative";
public static final String CHARGER_CREATIVE_NAME = "Creative Charger";

public static final String CHARGER_BLOCK_ENTITY = "charger";
public static final String CHARGER_CONTAINER = "charger";

public static final String WIRELESS_CHARGER_BLOCK = "wireless_charger";
public static final String WIRELESS_CHARGER_NAME = "Wireless Charger";
public static final String WIRELESS_CHARGER_BLOCK_ENTITY = WIRELESS_CHARGER_BLOCK;

public static final String CHARGER_BLOCK = "charger";
}
3 changes: 3 additions & 0 deletions src/main/java/se/gory_moon/chargers/LangKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public enum LangKeys {
GUI_DETAILS_OUT("gui.details.out"),
GUI_IO_MORE("gui.io.more"),

TOOLTIP_WIRELESS_CHARGER("tooltip.chargers.wireless_charger"),

CREATIVE_TAB("itemGroup.chargers.chargers"),
PACK_DESCRIPTION("pack.player_mobs.description");


Expand Down
1 change: 0 additions & 1 deletion src/main/java/se/gory_moon/chargers/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static String formatAndClean(long number) {
public static void addEnergyTooltip(ItemStack stack, List<Component> tooltip) {
IEnergyStorage energyStorage = stack.getCapability(Capabilities.EnergyStorage.ITEM);
if (energyStorage != null) {

String stored;
String max;
if (energyStorage instanceof CustomEnergyStorage storage) {
Expand Down
Loading

0 comments on commit 7750c03

Please sign in to comment.