-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 Sounds, Block Properties, and Models shit
- Loading branch information
Showing
4 changed files
with
86 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/gay/asoji/innerpastels/datagen/CustomModelTemplates.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package gay.asoji.innerpastels.datagen | ||
|
||
import net.minecraft.data.models.model.ModelTemplate | ||
import net.minecraft.data.models.model.TextureSlot | ||
import net.minecraft.resources.ResourceLocation | ||
import java.util.* | ||
|
||
/** | ||
* Quick way to use model templates that don't exist in vanilla like `template_spawn_egg`, using strings alone or with texture slots | ||
*/ | ||
object CustomModelTemplates { | ||
|
||
// TODO: KDocs later, not in the mood to do them at the moment | ||
fun createCustomBlockModel(modID: String, string: String): ModelTemplate { | ||
return ModelTemplate(Optional.of(ResourceLocation(modID, "block/$string")), Optional.empty()) | ||
} | ||
|
||
fun createCustomBlockModel(modID: String, string: String, textureSlots: TextureSlot): ModelTemplate { | ||
return ModelTemplate(Optional.of(ResourceLocation(modID, "block/$string")), Optional.empty(), textureSlots) | ||
} | ||
|
||
fun createCustomBlockModel(modID: String, string: String, suffix: String, textureSlots: TextureSlot): ModelTemplate { | ||
return ModelTemplate(Optional.of(ResourceLocation(modID, "block/$string")), Optional.of(suffix), textureSlots) | ||
} | ||
|
||
// maybe have `template_spawn_egg` or some shit for the string belong be a string enum? idk lol | ||
fun createCustomItemModel(modID: String, string: String): ModelTemplate { | ||
return ModelTemplate(Optional.of(ResourceLocation(modID, "item/$string")), Optional.empty()) | ||
} | ||
|
||
fun createCustomItemModel(modID: String, string: String, textureSlots: TextureSlot): ModelTemplate { | ||
return ModelTemplate(Optional.of(ResourceLocation(modID, "item/$string")), Optional.empty(), textureSlots) | ||
} | ||
|
||
fun createCustomItemModel(modID: String, string: String, suffix: String, textureSlots: TextureSlot): ModelTemplate { | ||
return ModelTemplate(Optional.of(ResourceLocation(modID, "item/$string")), Optional.of(suffix), textureSlots) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/gay/asoji/innerpastels/sounds/RegisterSounds.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gay.asoji.innerpastels.sounds | ||
|
||
import net.minecraft.core.Registry | ||
import net.minecraft.core.registries.BuiltInRegistries | ||
import net.minecraft.resources.ResourceLocation | ||
import net.minecraft.sounds.SoundEvent | ||
import net.minecraft.world.item.Item | ||
import net.minecraft.world.item.RecordItem | ||
|
||
/** | ||
* Quickly register sound-related stuff, like a music disc or sound event. | ||
*/ | ||
object RegisterSounds { | ||
// TODO: Work on docs for this later, not in the mood to do it right now | ||
fun registerSoundEvent(modID: String, name: String): SoundEvent { | ||
return Registry.register(BuiltInRegistries.SOUND_EVENT, ResourceLocation(modID, name), SoundEvent.createVariableRangeEvent(ResourceLocation(modID, name))) | ||
} | ||
|
||
fun registerMusicDisc(modID: String, name: String, analogOutput: Int, soundEvent: SoundEvent, seconds: Int): RecordItem { | ||
return Registry.register(BuiltInRegistries.ITEM, ResourceLocation(modID, name), RecordItem(analogOutput, soundEvent, Item.Properties().stacksTo(1), seconds)) | ||
} | ||
} |