Skip to content

Commit

Permalink
Fix Amethyst Music Disc (mostly)
Browse files Browse the repository at this point in the history
Also updated Gradle, Loom, and NeoGradle for 1.21.1
  • Loading branch information
EmpressAutumn committed Nov 25, 2024
1 parent 9626b26 commit a8afb97
Show file tree
Hide file tree
Showing 39 changed files with 138 additions and 141 deletions.
5 changes: 2 additions & 3 deletions common/src/main/java/com/atom596/titanium/Titanium.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
import com.atom596.titanium.item.TitaniumItemGroup;
import com.atom596.titanium.item.TitaniumItems;
import com.atom596.titanium.item.TitaniumPotions;
import com.atom596.titanium.sound.TitaniumSounds;
import org.slf4j.LoggerFactory;

public class Titanium {
public static final String MOD_ID = "titanium";
public static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final String MOD_NAME = "Titanium";
public static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);

public static void initialize() {
TitaniumArmorMaterial.init();
TitaniumSounds.init();
TitaniumPotions.init();
TitaniumBlocks.init();
TitaniumItems.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import com.atom596.titanium.Titanium;
import com.atom596.titanium.regutils.RegistrationProvider;
import com.atom596.titanium.regutils.RegistryObject;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
Expand All @@ -28,7 +26,7 @@ public class TitaniumArmorMaterial {
15,
SoundEvents.ARMOR_EQUIP_IRON,
() -> Ingredient.of(TitaniumItems.TITANIUM_INGOT.get()),
List.of(new ArmorMaterial.Layer(new ResourceLocation(Titanium.MOD_ID, "titanium"))),
List.of(new ArmorMaterial.Layer(ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "titanium"))),
1.0f,
0.0f
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import com.atom596.titanium.regutils.RegistrationProvider;
import com.atom596.titanium.regutils.RegistryObject;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.*;

public class TitaniumItems {
Expand Down Expand Up @@ -35,7 +38,7 @@ public class TitaniumItems {
public static final RegistryObject<Item, Item> TITANIUM_INGOT = ITEMS.register("titanium_ingot",
() -> new Item(new Item.Properties()));
public static final RegistryObject<Item, Item> MUSIC_DISC_AMETHYST = ITEMS.register("music_disc_amethyst",
TitaniumRecordItem::new);
() -> new Item(new Item.Properties().stacksTo(1).rarity(Rarity.RARE).jukeboxPlayable(ResourceKey.create(Registries.JUKEBOX_SONG, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "amethyst")))));
public static final RegistryObject<Item, Item> TITANIUM_HORSE_ARMOR = ITEMS.register("titanium_horse_armor",
() -> new AnimalArmorItem(TitaniumArmorMaterial.INSTANCE.asHolder(), AnimalArmorItem.BodyType.EQUESTRIAN, false, new Item.Properties().stacksTo(1)));
public static final RegistryObject<Item, Item> END_POWDER = ITEMS.register("end_powder",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ private void gen_barrel(FeaturePlaceContext<GeodeConfiguration> context, Callbac

structureWorldAccess.setBlock(barrelPos, Blocks.BARREL.defaultBlockState(), Block.UPDATE_CLIENTS);
RandomizableContainer.setBlockEntityLootTable(structureWorldAccess, random, barrelPos,
ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(Titanium.MOD_ID, "chests/amethyst_barrel")));
ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "chests/amethyst_barrel")));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context)
}

public static ResourceKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(Titanium.MOD_ID, name));
return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, name));
}

private static <FC extends OreConfiguration, F extends Feature<FC>> void register(BootstrapContext<ConfiguredFeature<?, ?>> context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void bootstrap(BootstrapContext<PlacedFeature> context) {
}

public static ResourceKey<PlacedFeature> registerKey(String name) {
return ResourceKey.create(Registries.PLACED_FEATURE, new ResourceLocation(Titanium.MOD_ID, name));
return ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, name));
}

private static void register(BootstrapContext<PlacedFeature> context, ResourceKey<PlacedFeature> key, Holder<ConfiguredFeature<?, ?>> configuration,
Expand Down
3 changes: 2 additions & 1 deletion common/src/main/resources/assets/titanium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"item.titanium.titanium_nugget": "Titanium Nugget",
"item.titanium.titanium_ingot": "Titanium Ingot",
"item.titanium.music_disc_amethyst": "Music Disc",
"item.titanium.music_disc_amethyst.desc": "DestoLynx - Amethyst",
"item.titanium.titanium_horse_armor": "Titanium Horse Armor",
"item.titanium.end_powder": "End Powder",
"item.titanium.flight_charge": "Flight Charge",
Expand All @@ -27,6 +26,8 @@

"itemGroup.titanium.titanium_group": "Titanium",

"jukebox_song.titanium.amethyst": "DestoLynx - Amethyst",

"advancements.titanium.get_titanium.title": "Harder Than Steel",
"advancements.titanium.get_titanium.description": "Smelt a Titanium Ingot",
"advancements.titanium.titanium_tools.title": "A Temporary Improvement",
Expand Down
6 changes: 2 additions & 4 deletions common/src/main/resources/assets/titanium/sounds.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"music_disc_amethyst": {
"category": "records",
"music_disc.amethyst": {
"sounds": [
{
"name": "titanium:amethyst",
"stream": true
"name": "titanium:records/amethyst"
}
]
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"comparator_output": 14,
"description": "jukebox_song.titanium.amethyst",
"length_in_seconds": 144.692,
"sound_event": {
"sound_id": "titanium:music_disc.amethyst",
"range": 64.0
}
}
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'multiloader-loader'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.8-SNAPSHOT'
}
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/java/com/atom596/titanium/TitaniumFabric.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void addCreative() {
content.addAfter(TitaniumItems.TITANIUM_SHOVEL.get(), TitaniumItems.TITANIUM_PICKAXE.get());
content.addAfter(TitaniumItems.TITANIUM_PICKAXE.get(), TitaniumItems.TITANIUM_AXE.get());
content.addAfter(TitaniumItems.TITANIUM_AXE.get(), TitaniumItems.TITANIUM_HOE.get());
content.addAfter(Items.FIRE_CHARGE, TitaniumItems.FLIGHT_CHARGE.get());
content.addAfter(Items.WIND_CHARGE, TitaniumItems.FLIGHT_CHARGE.get());
content.addAfter(Items.MUSIC_DISC_PIGSTEP, TitaniumItems.MUSIC_DISC_AMETHYST.get());
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register(content -> {
Expand All @@ -54,7 +54,7 @@ private void addCreative() {
content.addAfter(Items.RAW_GOLD, TitaniumItems.RAW_TITANIUM.get());
content.addAfter(Items.GOLD_NUGGET, TitaniumItems.TITANIUM_NUGGET.get());
content.addAfter(Items.GOLD_INGOT, TitaniumItems.TITANIUM_INGOT.get());
content.addAfter(Items.FIRE_CHARGE, TitaniumItems.FLIGHT_CHARGE.get());
content.addAfter(Items.WIND_CHARGE, TitaniumItems.FLIGHT_CHARGE.get());
content.addAfter(Items.BLAZE_POWDER, TitaniumItems.END_POWDER.get());
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.OP_BLOCKS).register(content -> {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ group=com.atom596.titanium
java_version=21

# Common
minecraft_version=1.20.5
minecraft_version=1.21.1
mod_name=Titanium
mod_author=EmpressAutumn
mod_id=titanium
license=CC0-1.0
credits=
description=The description of your mod. \nAccepts multilines.
minecraft_version_range=[1.20.5, 1.21)
minecraft_version_range=[1.21, 1.22)

# Fabric
fabric_version=0.97.6+1.20.5
fabric_loader_version=0.15.10
fabric_version=0.107.0+1.21.1
fabric_loader_version=0.16.9

# NeoForge
neoforge_version=20.5.0-beta
neoforge_version=21.1.73
neoforge_loader_version_range=[2,)

# Plugins
regutils_version=1.20.6-0.1.0
regutils_version=1.21.0-0.1.0

# Gradle
org.gradle.jvmargs=-Xmx8G
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 1 addition & 3 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import net.neoforged.gradle.dsl.common.runs.run.Run

plugins {
id "multiloader-loader"
id "net.neoforged.gradle.userdev" version "7.0.107"
id "net.neoforged.gradle.userdev" version "7.0.171"
}
def at = file("src/main/resources/META-INF/accesstransformer.cfg")
if (at.exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.data.PackOutput;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.data.BlockTagsProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.data.event.GatherDataEvent;

Expand All @@ -19,13 +20,14 @@ public static void gatherData(GatherDataEvent event) {
PackOutput output = generator.getPackOutput();
ExistingFileHelper exFileHelper = event.getExistingFileHelper();
CompletableFuture<HolderLookup.Provider> completableFuture = event.getLookupProvider();
BlockTagsProvider blockTagsProvider = new TitaniumBlockTagProvider(output, completableFuture, exFileHelper);

//generator.addProvider(true, new TitaniumAdvancementProvider(output, completableFuture, exFileHelper));
generator.addProvider(true, new TitaniumAdvancementProvider(output, completableFuture, exFileHelper));
generator.addProvider(true, new TitaniumBlockStateProvider(output, exFileHelper));
generator.addProvider(true, new TitaniumBlockTagProvider(output, completableFuture, exFileHelper));
generator.addProvider(true, new TitaniumItemModelProvider(output, exFileHelper));
//generator.addProvider(true, new TitaniumItemTagProvider(output, completableFuture));
//generator.addProvider(true, new TitaniumLootTableProvider(output, completableFuture));
generator.addProvider(true, new TitaniumItemTagProvider(output, completableFuture, blockTagsProvider.contentsGetter(), exFileHelper));
generator.addProvider(true, new TitaniumLootTableProvider(output, completableFuture));
generator.addProvider(true, new TitaniumRecipeProvider(output, completableFuture));
generator.addProvider(true, new TitaniumWorldGenProvider(output, completableFuture));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.atom596.titanium;

import com.atom596.titanium.item.TitaniumItems;
import net.minecraft.world.item.CreativeModeTab;
import it.unimi.dsi.fastutil.objects.ObjectSortedSet;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.util.MutableHashedLinkedMap;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;

import java.util.function.Supplier;
Expand All @@ -22,7 +21,7 @@ public TitaniumNeoforge(IEventBus eventBus) {
}

private void addCreative(BuildCreativeModeTabContentsEvent event) {
MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility> entries = event.getEntries();
ObjectSortedSet<ItemStack> entries = event.getSearchEntries();
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) {
putAfter(entries, Items.LIGHT_WEIGHTED_PRESSURE_PLATE, TitaniumItems.TITANIUM_BLOCK);
event.accept(TitaniumItems.TITANIUM_BLOCK.get()); // After Light Weighted Pressure Plate
Expand Down Expand Up @@ -65,9 +64,14 @@ else if (event.getTabKey() == CreativeModeTabs.OP_BLOCKS) {
}
}

private static void putAfter(MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility> entries, ItemLike after, Supplier<? extends ItemLike> supplier) {
private static void putAfter(ObjectSortedSet<ItemStack> entries, ItemLike after, Supplier<? extends ItemLike> supplier) {
ItemLike key = supplier.get();
if (!entries.contains(new ItemStack(after))) return;
entries.putAfter(new ItemStack(after), new ItemStack(key), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
ObjectSortedSet<ItemStack> head = entries.headSet(new ItemStack(after));
ObjectSortedSet<ItemStack> tail = entries.tailSet(new ItemStack(after));
head.add(new ItemStack(key));
tail.remove(new ItemStack(after));
head.addAll(tail);
entries = head;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void generate(HolderLookup.Provider completableFuture, Consumer<AdvancementHolde
true,
false
)
.parent(new AdvancementHolder(new ResourceLocation("minecraft", "story/iron_tools"), null))
.parent(new AdvancementHolder(ResourceLocation.fromNamespaceAndPath("minecraft", "story/iron_tools"), null))
.addCriterion("got_titanium", InventoryChangeTrigger.TriggerInstance.hasItems(TitaniumItems.TITANIUM_INGOT.get()))
.save(consumer, new ResourceLocation(Titanium.MOD_ID, "get_titanium"), exFileHelper);
.save(consumer, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "get_titanium"), exFileHelper);

AdvancementHolder titaniumToolsAdvancement = new Advancement.Builder()
.display(
Expand All @@ -59,7 +59,7 @@ void generate(HolderLookup.Provider completableFuture, Consumer<AdvancementHolde
TitaniumItems.TITANIUM_AXE.get(),
TitaniumItems.TITANIUM_HOE.get()
))
.save(consumer, new ResourceLocation(Titanium.MOD_ID, "/titanium_tools"), exFileHelper);
.save(consumer, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "/titanium_tools"), exFileHelper);

AdvancementHolder titaniumArmorAdvancement = new Advancement.Builder()
.display(
Expand All @@ -79,6 +79,6 @@ void generate(HolderLookup.Provider completableFuture, Consumer<AdvancementHolde
TitaniumItems.TITANIUM_LEGGINGS.get(),
TitaniumItems.TITANIUM_BOOTS.get()
))
.save(consumer, new ResourceLocation(Titanium.MOD_ID, "/titanium_armor"), exFileHelper);
.save(consumer, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "/titanium_armor"), exFileHelper);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public static void bootstrap(BootstrapContext<BiomeModifier> context) {
}

private static ResourceKey<BiomeModifier> createKey(String name) {
return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, new ResourceLocation(Titanium.MOD_ID, name));
return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, name));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public TitaniumBlockTagProvider(PackOutput output, CompletableFuture<HolderLooku

@Override
protected void addTags(HolderLookup.Provider provider) {
this.tag(TagKey.create(Registries.BLOCK, new ResourceLocation(Titanium.MOD_ID, "titanium_ores"))).add(
this.tag(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "titanium_ores"))).add(
TitaniumBlocks.TITANIUM_ORE.get(),
TitaniumBlocks.TITANIUM_BLOCK.get(),
TitaniumBlocks.END_TITANIUM_ORE.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ protected void registerModels() {

private ItemModelBuilder simpleItem(RegistryObject<Item, Item> item) {
return withExistingParent(item.getId().getPath(),
new ResourceLocation("item/generated")).texture("layer0",
new ResourceLocation(Titanium.MOD_ID, "item/" + item.getId().getPath()));
ResourceLocation.withDefaultNamespace("item/generated")).texture("layer0",
ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "item/" + item.getId().getPath()));
}

private ItemModelBuilder handheldItem(RegistryObject<Item, Item> item) {
return withExistingParent(item.getId().getPath(),
new ResourceLocation("item/handheld")).texture("layer0",
new ResourceLocation(Titanium.MOD_ID, "item/" + item.getId().getPath()));
ResourceLocation.withDefaultNamespace("item/handheld")).texture("layer0",
ResourceLocation.fromNamespaceAndPath(Titanium.MOD_ID, "item/" + item.getId().getPath()));
}
}
Loading

0 comments on commit a8afb97

Please sign in to comment.