Skip to content

Commit

Permalink
21.4.63-beta added EntityType registers
Browse files Browse the repository at this point in the history
  • Loading branch information
Starexify committed Jan 18, 2025
1 parent f918f39 commit c289ec3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parchment_mappings_version=2025.01.05
minecraft_version=1.21.4
minecraft_version_range=[1.21.4, 1.22)

neo_version=21.4.58-beta
neo_version=21.4.63-beta
neo_version_range=[21.4,)
loader_version_range=[4,)

Expand Down
3 changes: 3 additions & 0 deletions src/generated/resources/assets/nmt/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"container.ender_brewing": "Ender Brewing Stand",
"effect.nmt.burn": "Burn",
"emi.category.nmt.ender_brewing": "Ender Brewing",
"item.nmt.blazing_wither_soul": "Blazing Wither Soul",
"item.nmt.ender_wart": "Ender Wart",
"item.nmt.heart_of_the_hell": "Heart of the Hell",
"item.nmt.lingering_obsidian_potion.effect.awfully": "Lingering Awfully Potion",
"item.nmt.lingering_obsidian_potion.effect.cecity": "Lingering Potion of Cecity",
"item.nmt.lingering_obsidian_potion.effect.dimness": "Lingering Potion of Dimness",
Expand Down Expand Up @@ -61,6 +63,7 @@
"item.nmt.splash_obsidian_potion.effect.titan": "Splash Potion of the Titan",
"item.nmt.splash_obsidian_potion.effect.unluck": "Splash Potion of Unluck",
"item.nmt.splash_obsidian_potion.effect.withering": "Splash Potion of Withering",
"item.nmt.tear_of_the_nether": "Tear of the Nether",
"nmt.creativetab.main": "No More Things",
"nmt.creativetab.potions": "No More Things Potions"
}
4 changes: 2 additions & 2 deletions src/main/java/net/nova/nmt/data/LangProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ protected void addTranslations() {
addObsidianPotion(NMTItems.OBSIDIAN_TIPPED_ARROW, NMTPotions.UNLUCK, "Arrow of Unluck");
addObsidianPotion(NMTItems.OBSIDIAN_TIPPED_ARROW, NMTPotions.WITHERING, "Arrow of Withering");

/*addItem(NMTItems.TEAR_OF_THE_NETHER, "Tear of the Nether");
addItem(NMTItems.TEAR_OF_THE_NETHER, "Tear of the Nether");
addItem(NMTItems.BLAZING_WITHER_SOUL, "Blazing Wither Soul");
addItem(NMTItems.HEART_OF_THE_HELL, "Heart of the Hell");*/
addItem(NMTItems.HEART_OF_THE_HELL, "Heart of the Hell");

// Creative Tab
add(CreativeTab.MAIN_TAB_TITLE, "No More Things");
Expand Down
19 changes: 4 additions & 15 deletions src/main/java/net/nova/nmt/init/NMTEntityType.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package net.nova.nmt.init;

import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.nova.nmt.NoMoreThings;
import net.nova.nmt.entity.projectile.ThrownObsidianPotion;

import java.util.function.Supplier;

import static net.nova.nmt.NoMoreThings.MODID;

public class NMTEntityType {
public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(Registries.ENTITY_TYPE, MODID);
public static final DeferredRegister.Entities ENTITY_TYPES = DeferredRegister.createEntities(MODID);

public static final Supplier<EntityType<ThrownObsidianPotion>> OBSIDIAN_POTION = register("obsidian_potion",
EntityType.Builder.<ThrownObsidianPotion>of(ThrownObsidianPotion::new, MobCategory.MISC)
public static final DeferredHolder<EntityType<?>, EntityType<ThrownObsidianPotion>> OBSIDIAN_POTION = ENTITY_TYPES.registerEntityType("obsidian_potion",
ThrownObsidianPotion::new, MobCategory.MISC, meteoriteBuilder -> meteoriteBuilder
.noLootTable()
.sized(0.25F, 0.25F)
.clientTrackingRange(4)
Expand All @@ -31,10 +26,4 @@ public class NMTEntityType {
.updateInterval(10)
.build("fireball_projectile")
);*/

public static <T extends Entity> Supplier<EntityType<T>> register(String name, EntityType.Builder<T> builder) {
return ENTITY_TYPES.register(ResourceKey.create(Registries.ENTITY_TYPE, NoMoreThings.rl(name)).location().getPath(),
() -> builder.build(ResourceKey.create(Registries.ENTITY_TYPE, NoMoreThings.rl(name)))
);
}
}

0 comments on commit c289ec3

Please sign in to comment.