Compare commits

...

1 commit
1.0 ... main

Author SHA1 Message Date
524075d8e4 Minor changes
All checks were successful
Build and upload mods / packwizInstall (push) Successful in 6m2s
2024-12-17 18:19:43 +01:00
3 changed files with 5 additions and 38 deletions

View file

@ -18,5 +18,5 @@ jobs:
if: success()
uses: actions/upload-artifact@v3
with:
name: mods
name: minecartspeed.jar
path: build/libs/minecartspeed-1.0-SNAPSHOT.jar

View file

@ -13,7 +13,7 @@ minecraft_version=1.21.1
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21.1,1.22)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.1.90
neo_version=21.1.83
# The Neo version range can use any version of Neo as bounds
neo_version_range=[21,)
# The loader version range can only use the major version of FML as bounds
@ -25,7 +25,7 @@ parchment_mappings_version=2024.11.17
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=minecartspeed
# The human-readable display name for the mod.
mod_name=minecartspeed
mod_name=Minecart speed
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GNU GPL 3.0
# The mod version. See https://semver.org/
@ -35,6 +35,6 @@ mod_version=1.0-SNAPSHOT
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=eu.toldi
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=
mod_authors=Bazsalanszky
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=
mod_description=Change the speed of minecarts through game rules.

View file

@ -40,25 +40,6 @@ public class Minecartspeed {
public static final String MODID = "minecartspeed";
// 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 "minecartspeed" namespace
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MODID);
// Create a Deferred Register to hold Items which will all be registered under the "minecartspeed" namespace
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID);
// Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "minecartspeed" namespace
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
// Creates a new Block with the id "minecartspeed:example_block", combining the namespace and path
public static final DeferredBlock<Block> EXAMPLE_BLOCK = BLOCKS.registerSimpleBlock("example_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE));
// Creates a new BlockItem with the id "minecartspeed: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 "minecartspeed: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().alwaysEdible().nutrition(1).saturationModifier(2f).build()));
// Creates a creative tab with the id "minecartspeed: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.minecartspeed")).withTabsBefore(CreativeModeTabs.COMBAT).icon(() -> EXAMPLE_ITEM.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
}).build());
public static final GameRules.Key<GameRules.IntegerValue> RULE_MINECART_SPEED = GameRules.register("minecartspeed:multiplier_percentage", GameRules.Category.MISC, GameRules.IntegerValue.create(100));
@ -68,21 +49,12 @@ public class Minecartspeed {
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
// Register the Deferred Register to the mod event bus so blocks get registered
BLOCKS.register(modEventBus);
// Register the Deferred Register to the mod event bus so items get registered
ITEMS.register(modEventBus);
// Register the Deferred Register to the mod event bus so tabs get registered
CREATIVE_MODE_TABS.register(modEventBus);
// Register ourselves for server and other game events we are interested in.
// Note that this is necessary if and only if we want *this* class (Minecartspeed) to respond directly to events.
// Do not add this line if there are no @SubscribeEvent-annotated functions in this class, like onServerStarting() below.
NeoForge.EVENT_BUS.register(this);
// Register the item to a creative tab
modEventBus.addListener(this::addCreative);
// Register our mod's ModConfigSpec so that FML can create and load the config file for us
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
@ -99,11 +71,6 @@ public class Minecartspeed {
Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString()));
}
// Add the example block item to the building blocks tab
private void addCreative(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(EXAMPLE_BLOCK_ITEM);
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {