[WIP] major rewrite, grass and leaves working already
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package mods.betterfoliage.util
|
||||
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.model.Material
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture
|
||||
import net.minecraft.resources.IReloadableResourceManager
|
||||
import net.minecraft.resources.IResource
|
||||
import net.minecraft.resources.IResourceManager
|
||||
@@ -13,6 +15,15 @@ val resourceManager: IReloadableResourceManager
|
||||
/** Append a string to the [ResourceLocation]'s path. */
|
||||
operator fun ResourceLocation.plus(str: String) = ResourceLocation(namespace, path + str)
|
||||
|
||||
/** Prepend a string to the [ResourceLocation]'s path. */
|
||||
fun ResourceLocation.prependLocation(basePath: String) =
|
||||
ResourceLocation(namespace, basePath.stripEnd("/").let { "$it/$path" })
|
||||
|
||||
val ResourceLocation.asBlockMaterial: Material get() = Material(
|
||||
AtlasTexture.LOCATION_BLOCKS_TEXTURE,
|
||||
this
|
||||
)
|
||||
|
||||
/** Index operator to get a resource. */
|
||||
operator fun IResourceManager.get(domain: String, path: String): IResource? = get(ResourceLocation(domain, path))
|
||||
/** Index operator to get a resource. */
|
||||
|
||||
Reference in New Issue
Block a user