Skip to content

Commit da91041

Browse files
committed
Working item value calculations.
1 parent a2856d7 commit da91041

File tree

11 files changed

+360
-221
lines changed

11 files changed

+360
-221
lines changed

README.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
1-
2-
Installation information
1+
MC Trade Post
32
=======
4-
5-
This template repository can be directly cloned to get you started with a new
6-
mod. Simply create a new repository cloned from this one, by following the
7-
instructions at [github](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
8-
9-
Once you have your clone, simply open the repository in the IDE of your choice. The usual recommendation for an IDE is either IntelliJ IDEA or Eclipse.
10-
11-
> **Note**: For Eclipse, use tasks in `Launch Group` instead of ones founds in `Java Application`. A preparation task must run before launching the game. NeoGradle uses launch groups to do these subsequently.
12-
13-
If at any point you are missing libraries in your IDE, or you've run into problems you can
14-
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
15-
{this does not affect your code} and then start the process again.
16-
17-
Mapping Names:
18-
============
19-
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
20-
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
21-
license. For the latest license text, refer to the mapping file itself, or the reference copy here:
22-
https://github.com/NeoForged/NeoForm/blob/main/Mojang.md
3+
TODO: Description
4+
TODO: How-To
5+
TODO: Roadmap
236

247
Additional Resources:
258
==========
269
Community Documentation: https://docs.neoforged.net/
2710
NeoForged Discord: https://discord.neoforged.net/
11+
Minecolonies: https://minecolonies.com/

src/main/java/com/deathfrog/mctradepost/MCTradePostMod.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.deathfrog.mctradepost.core.client.model.FemaleShopkeeperModel;
1313
import com.deathfrog.mctradepost.core.client.model.MaleShopkeeperModel;
1414
import com.deathfrog.mctradepost.core.client.render.AdvancedClipBoardDecorator;
15+
import com.deathfrog.mctradepost.core.colony.jobs.buildings.modules.ItemValueRegistry;
1516
import com.deathfrog.mctradepost.core.event.ClientRegistryHandler;
1617
import com.deathfrog.mctradepost.item.AdvancedClipboardItem;
1718
import com.minecolonies.api.blocks.ModBlocks;
@@ -41,6 +42,7 @@
4142
import net.neoforged.neoforge.client.event.RegisterItemDecorationsEvent;
4243
import net.neoforged.neoforge.common.NeoForge;
4344
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
45+
import net.neoforged.neoforge.event.server.ServerStartedEvent;
4446
import net.neoforged.neoforge.event.server.ServerStartingEvent;
4547
import net.neoforged.neoforge.registries.DeferredItem;
4648
import net.neoforged.neoforge.registries.DeferredRegister;
@@ -119,14 +121,13 @@ public MCTradePostMod(IEventBus modEventBus, ModContainer modContainer)
119121
ModJobsInitializer.DEFERRED_REGISTER.register(modEventBus);
120122
TileEntityInitializer.BLOCK_ENTITIES.register(modEventBus);
121123
ModBuildingsInitializer.DEFERRED_REGISTER.register(modEventBus);
122-
ModSoundEvents.SOUND_EVENTS.register(modEventBus);
124+
ModSoundEvents.SOUND_EVENTS.register(modEventBus);
123125
}
124126

125127
private void commonSetup(final FMLCommonSetupEvent event)
126128
{
127129
// Some common setup code
128130
LOGGER.info("MCTradePost common setup");
129-
130131
}
131132

132133
// Add the example block item to the building blocks tab
@@ -143,7 +144,7 @@ private void addCreative(BuildCreativeModeTabContentsEvent event)
143144
}
144145

145146
private void onLoadComplete(final FMLLoadCompleteEvent event) {
146-
LOGGER.info("MCTradePost loaded");
147+
LOGGER.info("MCTradePost onLoadComplete");
147148
}
148149

149150
/**
@@ -175,6 +176,24 @@ public void onServerStarting(ServerStartingEvent event)
175176
LOGGER.info("HELLO from server starting");
176177
}
177178

179+
@SubscribeEvent
180+
public void onServerStarted(ServerStartedEvent event)
181+
{
182+
// Derive the value of all items
183+
LOGGER.info("Server has started.");
184+
ItemValueRegistry.generateValues();
185+
ItemValueRegistry.logValues();
186+
}
187+
188+
@EventBusSubscriber(modid = MCTradePostMod.MODID)
189+
public class ServerEventHandler {
190+
191+
@SubscribeEvent
192+
public static void onServerStarting(ServerStartingEvent event) {
193+
MCTradePostMod.LOGGER.info("Server starting.");
194+
}
195+
}
196+
178197
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
179198
@EventBusSubscriber(modid = MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
180199
public static class ClientModEvents

src/main/java/com/deathfrog/mctradepost/apiimp/initializer/ModBuildingsInitializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ private ModBuildingsInitializer()
3535
.addBuildingModuleProducer(MCTPBuildingModules.SHOPKEEPER_WORK)
3636
.addBuildingModuleProducer(MCTPBuildingModules.ITEMLIST_SELLABLE)
3737
.addBuildingModuleProducer(MCTPBuildingModules.ECON_MODULE)
38+
.addBuildingModuleProducer(MCTPBuildingModules.ECON_SETTINGS)
3839
.addBuildingModuleProducer(BuildingModules.MIN_STOCK)
3940
.addBuildingModuleProducer(BuildingModules.STATS_MODULE)
4041
.createBuildingEntry());

src/main/java/com/deathfrog/mctradepost/core/client/gui/MCTPAbstractModuleWindow.java

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)