Skip to content

Commit

Permalink
Initial commit with a basic implementation for the test tube
Browse files Browse the repository at this point in the history
  • Loading branch information
Blasto33 committed Nov 8, 2024
1 parent ecbe4c2 commit 98973fc
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 22 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ loader_version_range=[4,)

# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
mod_id=chemlib
# The human-readable display name for the mod.
mod_name=Example Mod
mod_name=ChemLib
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
mod_group_id=com.blasto.chemlib
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
mod_authors=Blasto
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
mod_description=A modern library that brings the periodic table of elements to Minecraft.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.examplemod;
package com.blasto.chemlib;

import org.slf4j.Logger;

Expand Down Expand Up @@ -35,11 +35,11 @@
import net.neoforged.neoforge.registries.DeferredRegister;

// The value here should match an entry in the META-INF/neoforge.mods.toml file
@Mod(ExampleMod.MODID)
public class ExampleMod
@Mod(ChemLib.MODID)
public class ChemLib
{
// Define mod id in a common place for everything to reference
public static final String MODID = "examplemod";
public static final String MODID = "chemlib";
// Directly reference a slf4j logger
private static final Logger LOGGER = LogUtils.getLogger();
// Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace
Expand All @@ -54,22 +54,22 @@ public class ExampleMod
// Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path
public static final DeferredItem<BlockItem> EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK);

// Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2
public static final DeferredItem<Item> EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder()
// Creates a new food item with the id "chemlib:example_id", nutrition 1 and saturation 2
public static final DeferredItem<Item> TEST_TUBE = ITEMS.registerSimpleItem("test_tube", new Item.Properties().food(new FoodProperties.Builder()
.alwaysEdible().nutrition(1).saturationModifier(2f).build()));

// Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.examplemod")) //The language key for the title of your CreativeModeTab
.title(Component.translatable("itemGroup.chemlib")) //The language key for the title of your CreativeModeTab
.withTabsBefore(CreativeModeTabs.COMBAT)
.icon(() -> EXAMPLE_ITEM.get().getDefaultInstance())
.icon(() -> TEST_TUBE.get().getDefaultInstance())
.displayItems((parameters, output) -> {
output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
output.accept(TEST_TUBE.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
}).build());

// The constructor for the mod class is the first code that is run when your mod is loaded.
// FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically.
public ExampleMod(IEventBus modEventBus, ModContainer modContainer)
public ChemLib(IEventBus modEventBus, ModContainer modContainer)
{
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.examplemod;
package com.blasto.chemlib;

import java.util.List;
import java.util.Set;
Expand All @@ -14,7 +14,7 @@

// 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 = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD)
@EventBusSubscriber(modid = ChemLib.MODID, bus = EventBusSubscriber.Bus.MOD)
public class Config
{
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/assets/chemlib/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"itemGroup.chemlib": "Chemlib Tab",
"block.examplemod.example_block": "Example Block",
"item.chemlib.test_tube": "Test Tube"
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/chemlib/models/item/test_tube.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "chemlib:item/test_tube"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions src/main/resources/assets/examplemod/lang/en_us.json

This file was deleted.

0 comments on commit 98973fc

Please sign in to comment.