2025-03-05 Welcome and Setup aktualisiert
@@ -34,6 +34,43 @@ in `src/main/resources/fabric.mod.json`:
|
|||||||
|
|
||||||
**Custom Items** https://www.youtube.com/watch?v=9xflCDe-Ruw&ab_channel=ModdingbyKaupenjoe
|
**Custom Items** https://www.youtube.com/watch?v=9xflCDe-Ruw&ab_channel=ModdingbyKaupenjoe
|
||||||
|
|
||||||
|
```java
|
||||||
|
package de.jottyfan.gta.gdp.item;
|
||||||
|
|
||||||
|
import de.jottyfan.gta.gdp.GTAGDP;
|
||||||
|
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroups;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ModItems {
|
||||||
|
|
||||||
|
public static final Item STUB = registerItem(Identifier.of(GTAGDP.MOD_ID, "stub"), new Item.Settings());
|
||||||
|
|
||||||
|
private static Item registerItem(Identifier identifier, Settings settings) {
|
||||||
|
return Registry.register(Registries.ITEM, identifier,
|
||||||
|
new Item(settings.useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerModItems() {
|
||||||
|
GTAGDP.LOGGER.info("registering mod items for " + GTAGDP.MOD_ID);
|
||||||
|
|
||||||
|
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
|
||||||
|
entries.add(STUB);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
in `GTAGDP`, modify to:
|
in `GTAGDP`, modify to:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|||||||
Reference in New Issue
Block a user