替换模组标签页图标

This commit is contained in:
Atsuihsio 2024-08-09 15:27:57 +08:00
parent 0a0f6938c9
commit 50f7d60bef
5 changed files with 21 additions and 1 deletions

View file

@ -389,6 +389,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
living.gameEvent(GameEvent.ENTITY_DIE); living.gameEvent(GameEvent.ENTITY_DIE);
} }
level().playSound(living, new BlockPos((int) living.getX(), (int) living.getY(), (int) living.getZ()), ModSounds.OUCH.get(), SoundSource.PLAYERS, 2.0F, 1.0F);
return; return;
} }

View file

@ -20,6 +20,9 @@ import net.minecraftforge.registries.RegistryObject;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ModItems { public class ModItems {
public static final DeferredRegister<Item> REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, ModUtils.MODID);
public static final RegistryObject<Item> EXAMPLE_PERK = REGISTRY.register("example_perk", ExamplePerk::new);
/** /**
* guns * guns
*/ */
@ -182,6 +185,7 @@ public class ModItems {
public static final RegistryObject<Item> BARBED_WIRE = block(ModBlocks.BARBED_WIRE); public static final RegistryObject<Item> BARBED_WIRE = block(ModBlocks.BARBED_WIRE);
public static final RegistryObject<Item> DRAGON_TEETH = block(ModBlocks.DRAGON_TEETH); public static final RegistryObject<Item> DRAGON_TEETH = block(ModBlocks.DRAGON_TEETH);
private static RegistryObject<Item> block(RegistryObject<Block> block) { private static RegistryObject<Item> block(RegistryObject<Block> block) {
return BLOCKS.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties())); return BLOCKS.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties()));
} }
@ -202,5 +206,6 @@ public class ModItems {
BLOCKS.register(bus); BLOCKS.register(bus);
registerPerkItems(); registerPerkItems();
PERKS.register(bus); PERKS.register(bus);
REGISTRY.register(bus);
} }
} }

View file

@ -58,7 +58,7 @@ public class ModTabs {
public static final RegistryObject<CreativeModeTab> PERK_TAB = TABS.register("perk", public static final RegistryObject<CreativeModeTab> PERK_TAB = TABS.register("perk",
() -> CreativeModeTab.builder() () -> CreativeModeTab.builder()
.title(Component.translatable("item_group.superbwarfare.perk")) .title(Component.translatable("item_group.superbwarfare.perk"))
.icon(() -> new ItemStack(ModItems.TRACHELIUM_BLUEPRINT.get())) .icon(() -> new ItemStack(ModItems.EXAMPLE_PERK.get()))
.withTabsBefore(GUN_TAB.getKey()) .withTabsBefore(GUN_TAB.getKey())
.displayItems((param, output) -> ModItems.PERKS.getEntries().forEach(registryObject -> output.accept(registryObject.get()))) .displayItems((param, output) -> ModItems.PERKS.getEntries().forEach(registryObject -> output.accept(registryObject.get())))
.build()); .build());

View file

@ -0,0 +1,8 @@
package net.mcreator.superbwarfare.item;
import net.minecraft.world.item.Item;
public class ExamplePerk extends Item {
public ExamplePerk() {
super(new Properties());
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "superbwarfare:item/perk/killing_tally"
}
}