Port to 1.21
This commit is contained in:
@@ -251,11 +251,11 @@ tasks.processResources {
|
||||
tasks.scanLicenses {
|
||||
scanConfiguration(nonModImplentation)
|
||||
scanConfiguration(configurations.modCompileClasspath.get())
|
||||
outputFile.set(file("$buildDir/LICENSES-FIRMAMENT.json"))
|
||||
outputFile.set(layout.buildDirectory.file("LICENSES-FIRMAMENT.json"))
|
||||
licenseFormatter.set(moe.nea.licenseextractificator.JsonLicenseFormatter())
|
||||
}
|
||||
tasks.create("printAllLicenses", LicenseDiscoveryTask::class.java, licensing).apply {
|
||||
outputFile.set(file("$buildDir/LICENSES-FIRMAMENT.txt"))
|
||||
outputFile.set(layout.buildDirectory.file("LICENSES-FIRMAMENT.txt"))
|
||||
licenseFormatter.set(moe.nea.licenseextractificator.TextLicenseFormatter())
|
||||
scanConfiguration(nonModImplentation)
|
||||
scanConfiguration(configurations.modCompileClasspath.get())
|
||||
@@ -268,7 +268,3 @@ tasks.create("printAllLicenses", LicenseDiscoveryTask::class.java, licensing).ap
|
||||
licensing.addExtraLicenseMatchers()
|
||||
|
||||
fletchingTable.defaultMixinEnvironment.set("client")
|
||||
|
||||
//vineflower {
|
||||
// toolVersion.set("1.9.1")
|
||||
//}
|
||||
|
||||
@@ -3,23 +3,22 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
[versions]
|
||||
minecraft = "1.20.6"
|
||||
minecraft = "1.21"
|
||||
fabric_loader = "0.15.11"
|
||||
fabric_api = "0.97.8+1.20.6"
|
||||
fabric_kotlin = "1.10.19+kotlin.1.9.23"
|
||||
yarn = "1.20.6+build.1"
|
||||
libgui = "10.0.0+1.20.6"
|
||||
rei = "15.0.728"
|
||||
modmenu = "10.0.0-beta.1"
|
||||
architectury = "12.0.27"
|
||||
fabric_api = "0.100.4+1.21"
|
||||
fabric_kotlin = "1.11.0+kotlin.2.0.0"
|
||||
yarn = "1.21+build.7"
|
||||
rei = "16.0.729"
|
||||
modmenu = "11.0.1"
|
||||
architectury = "13.0.3"
|
||||
|
||||
qolify = "1.3.0-1.20.2"
|
||||
citresewn = "1.1.3+1.20"
|
||||
sodium = "mc1.20.6-0.5.8"
|
||||
freecammod = "1.2.4+1.20.5"
|
||||
ncr = "Fabric-1.20.4-v2.5.0"
|
||||
explosiveenhancement = "1.2.2-1.20.x"
|
||||
notenoughanimations = "roq966Ei"
|
||||
sodium = "mc1.21-0.5.11"
|
||||
freecammod = "U5eR0FyR"
|
||||
ncr = "Fabric-1.21-v2.8.0"
|
||||
explosiveenhancement = "1.2.3-1.21.0"
|
||||
notenoughanimations = "WaI2x21x"
|
||||
|
||||
devauth = "1.2.0"
|
||||
ktor = "2.3.0"
|
||||
@@ -27,9 +26,9 @@ dbus_java = "4.2.1"
|
||||
neurepoparser = "1.4.0"
|
||||
hotswap_agent = "1.4.2-SNAPSHOT"
|
||||
mixinextras = "0.3.5"
|
||||
jarvis = "1.1.1"
|
||||
jarvis = "1.1.3"
|
||||
nealisp = "1.0.0"
|
||||
moulconfig = "9999.9999.9999"
|
||||
moulconfig = "3.0.0-beta.13"
|
||||
manninghamMills = "2.4.1"
|
||||
|
||||
[libraries]
|
||||
|
||||
@@ -30,21 +30,21 @@ import java.util.function.BiFunction;
|
||||
public abstract class CustomModelBakerPatch {
|
||||
|
||||
@Shadow
|
||||
protected abstract void addModel(ModelIdentifier modelId);
|
||||
protected abstract void loadItemModel(ModelIdentifier id);
|
||||
|
||||
@Shadow
|
||||
abstract UnbakedModel getOrLoadModel(Identifier id);
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<Identifier, UnbakedModel> modelsToBake;
|
||||
|
||||
@Shadow
|
||||
public abstract UnbakedModel getOrLoadModel(Identifier id);
|
||||
private Map<ModelIdentifier, UnbakedModel> modelsToBake;
|
||||
|
||||
@Inject(method = "bake", at = @At("HEAD"))
|
||||
public void onBake(BiFunction<Identifier, SpriteIdentifier, Sprite> spriteLoader, CallbackInfo ci) {
|
||||
BakeExtraModelsEvent.Companion.publish(new BakeExtraModelsEvent(this::addModel));
|
||||
public void onBake(ModelLoader.SpriteGetter spliteGetter, CallbackInfo ci) {
|
||||
BakeExtraModelsEvent.Companion.publish(new BakeExtraModelsEvent(this::loadItemModel));
|
||||
modelsToBake.values().forEach(model -> model.setParents(this::getOrLoadModel));
|
||||
modelsToBake.keySet().stream()
|
||||
.filter(it -> !it.getNamespace().equals("minecraft"))
|
||||
.forEach(it -> System.out.println("Non minecraft texture is being loaded: " + it));
|
||||
// modelsToBake.keySet().stream()
|
||||
// .filter(it -> !it.id().getNamespace().equals("minecraft"))
|
||||
// .forEach(it -> System.out.println("Non minecraft texture is being loaded: " + it));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import moe.nea.firmament.events.HotbarItemRenderEvent;
|
||||
import moe.nea.firmament.events.HudRenderEvent;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -21,13 +22,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(InGameHud.class)
|
||||
public class HudRenderEventsPatch {
|
||||
@Inject(method = "renderSleepOverlay", at = @At(value = "HEAD"))
|
||||
public void renderCallBack(DrawContext context, float tickDelta, CallbackInfo ci) {
|
||||
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickDelta));
|
||||
public void renderCallBack(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
|
||||
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickCounter));
|
||||
}
|
||||
|
||||
@Inject(method = "renderHotbarItem", at = @At("HEAD"))
|
||||
public void onRenderHotbarItem(DrawContext context, int x, int y, float tickDelta, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
|
||||
public void onRenderHotbarItem(DrawContext context, int x, int y, RenderTickCounter tickCounter, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
|
||||
if (stack != null && !stack.isEmpty())
|
||||
HotbarItemRenderEvent.Companion.publish(new HotbarItemRenderEvent(stack, context, x, y, tickDelta));
|
||||
HotbarItemRenderEvent.Companion.publish(new HotbarItemRenderEvent(stack, context, x, y, tickCounter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.llamalad7.mixinextras.sugar.Local;
|
||||
import moe.nea.firmament.events.WorldRenderLastEvent;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.world.tick.TickManager;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -26,10 +27,13 @@ public class WorldRenderLastEventPatch {
|
||||
private BufferBuilderStorage bufferBuilders;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.BEFORE))
|
||||
public void onWorldRenderLast(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci
|
||||
, @Local MatrixStack matrixStack) {
|
||||
public void onWorldRenderLast(
|
||||
RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer,
|
||||
LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2,
|
||||
CallbackInfo ci, @Local MatrixStack matrixStack
|
||||
) {
|
||||
var event = new WorldRenderLastEvent(
|
||||
matrixStack, tickDelta, renderBlockOutline,
|
||||
matrixStack, tickCounter, renderBlockOutline,
|
||||
camera, gameRenderer, lightmapTextureManager,
|
||||
this.bufferBuilders.getEntityVertexConsumers()
|
||||
);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
package moe.nea.firmament.mixins.accessor;
|
||||
|
||||
import kotlin.Deprecated;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -145,8 +145,8 @@ object Firmament {
|
||||
globalJob.cancel()
|
||||
})
|
||||
registerFirmamentEvents()
|
||||
ItemTooltipCallback.EVENT.register { a, b, c, d ->
|
||||
ItemTooltipEvent.publish(ItemTooltipEvent(a, b, c, d))
|
||||
ItemTooltipCallback.EVENT.register { stack, context, type, lines ->
|
||||
ItemTooltipEvent.publish(ItemTooltipEvent(stack, context, type, lines))
|
||||
}
|
||||
ScreenEvents.AFTER_INIT.register(ScreenEvents.AfterInit { client, screen, scaledWidth, scaledHeight ->
|
||||
ScreenEvents.afterRender(screen)
|
||||
@@ -157,7 +157,7 @@ object Firmament {
|
||||
}
|
||||
|
||||
|
||||
fun identifier(path: String) = Identifier(MOD_ID, path)
|
||||
fun identifier(path: String) = Identifier.of(MOD_ID, path)
|
||||
inline fun <reified T : Any> tryDecodeJsonFromStream(inputStream: InputStream): Result<T> {
|
||||
return runCatching {
|
||||
json.decodeFromStream<T>(inputStream)
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.network.PacketByteBuf
|
||||
import net.minecraft.network.codec.PacketCodec
|
||||
import net.minecraft.network.codec.PacketCodecs
|
||||
import net.minecraft.network.packet.CustomPayload
|
||||
import net.minecraft.util.Identifier
|
||||
import net.minecraft.util.Uuids
|
||||
import moe.nea.firmament.apis.ingame.FirmamentCustomPayload
|
||||
|
||||
@@ -19,6 +20,10 @@ interface FirmamentCustomPayloadMeta<T : FirmamentCustomPayload> {
|
||||
val ID: CustomPayload.Id<T>
|
||||
val CODEC: PacketCodec<PacketByteBuf, T>
|
||||
|
||||
fun id(name: String): CustomPayload.Id<T> {
|
||||
return CustomPayload.Id<T>(Identifier.of(name))
|
||||
}
|
||||
|
||||
fun intoType(): CustomPayload.Type<PacketByteBuf, T> {
|
||||
return CustomPayload.Type(ID, CODEC)
|
||||
}
|
||||
@@ -26,7 +31,7 @@ interface FirmamentCustomPayloadMeta<T : FirmamentCustomPayload> {
|
||||
|
||||
data class PartyInfoRequest(val version: Int) : FirmamentCustomPayload {
|
||||
companion object : FirmamentCustomPayloadMeta<PartyInfoRequest> {
|
||||
override val ID = CustomPayload.id<PartyInfoRequest>("hypixel:party_info")
|
||||
override val ID = id("hypixel:party_info")
|
||||
override val CODEC =
|
||||
PacketCodecs.VAR_INT.cast<PacketByteBuf>()
|
||||
.xmap(::PartyInfoRequest, PartyInfoRequest::version)
|
||||
@@ -116,7 +121,7 @@ data class PartyInfoResponseV1(
|
||||
|
||||
data class PartyInfoResponse(val data: HypixelVersionedPacketData<PartyInfoResponseV>) : FirmamentCustomPayload {
|
||||
companion object : FirmamentCustomPayloadMeta<PartyInfoResponse> {
|
||||
override val ID: CustomPayload.Id<PartyInfoResponse> = CustomPayload.id("hypixel:party_info")
|
||||
override val ID = id("hypixel:party_info")
|
||||
override val CODEC =
|
||||
CodecUtils
|
||||
.dispatchVersioned<PacketByteBuf, PartyInfoResponseV>(
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
package moe.nea.firmament.events
|
||||
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.render.RenderTickCounter
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
data class HotbarItemRenderEvent(
|
||||
val item: ItemStack,
|
||||
val context: DrawContext,
|
||||
val x: Int,
|
||||
val y: Int,
|
||||
val tickDelta: Float,
|
||||
val item: ItemStack,
|
||||
val context: DrawContext,
|
||||
val x: Int,
|
||||
val y: Int,
|
||||
val tickDelta: RenderTickCounter,
|
||||
) : FirmamentEvent() {
|
||||
companion object : FirmamentEventBus<HotbarItemRenderEvent>()
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
package moe.nea.firmament.events
|
||||
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.render.RenderTickCounter
|
||||
|
||||
/**
|
||||
* Called when hud elements should be rendered, before the screen, but after the world.
|
||||
*/
|
||||
data class HudRenderEvent(val context: DrawContext, val tickDelta: Float) : FirmamentEvent() {
|
||||
data class HudRenderEvent(val context: DrawContext, val tickDelta: RenderTickCounter) : FirmamentEvent() {
|
||||
companion object : FirmamentEventBus<HudRenderEvent>()
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
package moe.nea.firmament.events
|
||||
|
||||
import net.minecraft.client.item.TooltipType
|
||||
import net.minecraft.item.Item.TooltipContext
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.tooltip.TooltipType
|
||||
import net.minecraft.text.Text
|
||||
|
||||
data class ItemTooltipEvent(
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
package moe.nea.firmament.events
|
||||
|
||||
import org.joml.Matrix4f
|
||||
import net.minecraft.client.render.Camera
|
||||
import net.minecraft.client.render.GameRenderer
|
||||
import net.minecraft.client.render.LightmapTextureManager
|
||||
import net.minecraft.client.render.RenderTickCounter
|
||||
import net.minecraft.client.render.VertexConsumerProvider
|
||||
import net.minecraft.client.util.math.MatrixStack
|
||||
import net.minecraft.util.math.Position
|
||||
@@ -21,7 +21,7 @@ import net.minecraft.util.math.Vec3d
|
||||
*/
|
||||
data class WorldRenderLastEvent(
|
||||
val matrices: MatrixStack,
|
||||
val tickDelta: Float,
|
||||
val tickCounter: RenderTickCounter,
|
||||
val renderBlockOutline: Boolean,
|
||||
val camera: Camera,
|
||||
val gameRenderer: GameRenderer,
|
||||
@@ -29,8 +29,4 @@ data class WorldRenderLastEvent(
|
||||
val vertexConsumers: VertexConsumerProvider.Immediate,
|
||||
) : FirmamentEvent() {
|
||||
companion object : FirmamentEventBus<WorldRenderLastEvent>()
|
||||
data class TextRenderCall(val string: String, val position: Position)
|
||||
|
||||
val toRender = mutableListOf<TextRenderCall>(TextRenderCall("Test String", Vec3d(0.0, 0.0, 0.0)))
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ object ItemRarityCosmetics : FirmamentFeature {
|
||||
x, y,
|
||||
0,
|
||||
16, 16,
|
||||
MC.guiAtlasManager.getSprite(Identifier("firmament:item_rarity_background")),
|
||||
MC.guiAtlasManager.getSprite(Identifier.of("firmament:item_rarity_background")),
|
||||
r, g, b, 1F
|
||||
)
|
||||
}
|
||||
|
||||
@@ -190,10 +190,10 @@ object SlotLocking : FirmamentFeature {
|
||||
MC.guiAtlasManager.getSprite(
|
||||
when {
|
||||
isSlotLocked ->
|
||||
(Identifier("firmament:slot_locked"))
|
||||
(Identifier.of("firmament:slot_locked"))
|
||||
|
||||
isUUIDLocked ->
|
||||
(Identifier("firmament:uuid_locked"))
|
||||
(Identifier.of("firmament:uuid_locked"))
|
||||
|
||||
else ->
|
||||
error("unreachable")
|
||||
|
||||
@@ -42,7 +42,7 @@ data class InventoryButton(
|
||||
0,
|
||||
dimensions.width,
|
||||
dimensions.height,
|
||||
MC.guiAtlasManager.getSprite(Identifier("firmament:inventory_button_background"))
|
||||
MC.guiAtlasManager.getSprite(Identifier.of("firmament:inventory_button_background"))
|
||||
)
|
||||
context.drawItem(getItem(), 1, 1)
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ object PickaxeAbility : FirmamentFeature {
|
||||
event.context.matrices.translate(MC.window.scaledWidth / 2F, MC.window.scaledHeight / 2F, 0F)
|
||||
event.context.matrices.scale(TConfig.cooldownScale.toFloat(), TConfig.cooldownScale.toFloat(), 1F)
|
||||
RenderCircleProgress.renderCircle(
|
||||
event.context, Identifier("firmament", "textures/gui/circle.png"),
|
||||
event.context, Identifier.of("firmament", "textures/gui/circle.png"),
|
||||
getCooldownPercentage(ability.name, ability.cooldown).toFloat(),
|
||||
0f, 1f, 0f, 1f
|
||||
)
|
||||
|
||||
@@ -117,7 +117,7 @@ object CustomGlobalTextures : SinglePreparationResourceReloader<CustomGlobalText
|
||||
.mapNotNull {
|
||||
val key = it.key
|
||||
val guiClassResource =
|
||||
manager.getResource(Identifier(key.namespace, "filters/screen/${key.path}.json"))
|
||||
manager.getResource(Identifier.of(key.namespace, "filters/screen/${key.path}.json"))
|
||||
.getOrNull()
|
||||
?: return@mapNotNull runNull {
|
||||
logger.error("Failed to locate screen filter at $key")
|
||||
|
||||
@@ -34,7 +34,7 @@ object CustomModelOverrideParser {
|
||||
|
||||
|
||||
fun registerPredicateParser(name: String, parser: FirmamentModelPredicateParser) {
|
||||
predicateParsers[Identifier("firmament", name)] = parser
|
||||
predicateParsers[Identifier.of("firmament", name)] = parser
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -59,7 +59,7 @@ object CustomModelOverrideParser {
|
||||
val parsedPredicates = mutableListOf<FirmamentModelPredicate>()
|
||||
for (predicateName in predicates.keySet()) {
|
||||
if (!predicateName.startsWith("firmament:")) continue
|
||||
val identifier = Identifier(predicateName)
|
||||
val identifier = Identifier.of(predicateName)
|
||||
val parser = predicateParsers[identifier] ?: return neverPredicate
|
||||
val parsedPredicate = parser.parse(predicates[predicateName]) ?: return neverPredicate
|
||||
parsedPredicates.add(parsedPredicate)
|
||||
|
||||
@@ -9,7 +9,6 @@ package moe.nea.firmament.features.texturepack
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture
|
||||
import com.mojang.authlib.properties.Property
|
||||
import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents.Custom
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
|
||||
import net.minecraft.block.SkullBlock
|
||||
import net.minecraft.client.MinecraftClient
|
||||
@@ -62,10 +61,13 @@ object CustomSkyBlockTextures : FirmamentFeature {
|
||||
.endsWith(".json")
|
||||
}
|
||||
for (identifier in resources.keys) {
|
||||
val modelId = ModelIdentifier("firmskyblock",
|
||||
identifier.path.substring("models/item/".length,
|
||||
identifier.path.length - ".json".length),
|
||||
"inventory")
|
||||
val modelId = ModelIdentifier.ofInventoryVariant(
|
||||
Identifier.of(
|
||||
"firmskyblock",
|
||||
identifier.path.substring(
|
||||
"models/item/".length,
|
||||
identifier.path.length - ".json".length),
|
||||
))
|
||||
event.addModel(modelId)
|
||||
}
|
||||
}
|
||||
@@ -74,7 +76,7 @@ object CustomSkyBlockTextures : FirmamentFeature {
|
||||
fun onCustomModelId(it: CustomItemModelEvent) {
|
||||
if (!TConfig.enabled) return
|
||||
val id = it.itemStack.skyBlockId ?: return
|
||||
it.overrideModel = ModelIdentifier("firmskyblock", id.identifier.path, "inventory")
|
||||
it.overrideModel = ModelIdentifier.ofInventoryVariant(Identifier.of("firmskyblock", id.identifier.path))
|
||||
}
|
||||
|
||||
private val skullTextureCache = mutableMapOf<IdentityCharacteristics<ProfileComponent>, Any>()
|
||||
@@ -92,7 +94,7 @@ object CustomSkyBlockTextures : FirmamentFeature {
|
||||
|
||||
fun getSkullTexture(profile: ProfileComponent): Identifier? {
|
||||
val id = getSkullId(profile.properties["textures"].firstOrNull() ?: return null) ?: return null
|
||||
return Identifier("firmskyblock", "textures/placedskull/$id.png")
|
||||
return Identifier.of("firmskyblock", "textures/placedskull/$id.png")
|
||||
}
|
||||
|
||||
fun modifySkullTexture(
|
||||
|
||||
@@ -129,6 +129,10 @@ fun <T> makeRegistry(registryWrapper: RegistryWrapper.Impl<T>, key: RegistryKey<
|
||||
return Lifecycle.stable()
|
||||
}
|
||||
|
||||
override fun getDefaultEntry(): Optional<RegistryEntry.Reference<T>> {
|
||||
return Optional.empty()
|
||||
}
|
||||
|
||||
override fun getIds(): MutableSet<Identifier> {
|
||||
return idLookup.keys.mapTo(mutableSetOf()) { it.value }
|
||||
}
|
||||
@@ -251,7 +255,7 @@ class FakeWorld(
|
||||
registries[RegistryKeys.DIMENSION_TYPE].entryOf(
|
||||
RegistryKey.of(
|
||||
RegistryKeys.DIMENSION_TYPE,
|
||||
Identifier("minecraft", "overworld")
|
||||
Identifier.of("minecraft", "overworld")
|
||||
)
|
||||
),
|
||||
{ DummyProfiler.INSTANCE },
|
||||
@@ -436,7 +440,7 @@ class FakeWorld(
|
||||
override fun putMapState(id: MapIdComponent?, state: MapState?) {
|
||||
}
|
||||
|
||||
override fun getNextMapId(): MapIdComponent {
|
||||
override fun increaseAndGetMapId(): MapIdComponent {
|
||||
return MapIdComponent(0)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ object ModifyPlayerSkin : EntityModifier {
|
||||
override fun apply(entity: LivingEntity, info: JsonObject): LivingEntity {
|
||||
require(entity is GuiPlayer)
|
||||
info["cape"]?.let {
|
||||
entity.capeTexture = Identifier(it.asString)
|
||||
entity.capeTexture = Identifier.of(it.asString)
|
||||
}
|
||||
info["skin"]?.let {
|
||||
entity.skinTexture = Identifier(it.asString)
|
||||
entity.skinTexture = Identifier.of(it.asString)
|
||||
}
|
||||
info["slim"]?.let {
|
||||
entity.model = if (it.asBoolean) SkinTextures.Model.SLIM else SkinTextures.Model.WIDE
|
||||
|
||||
@@ -42,7 +42,7 @@ class FirmamentReiPlugin : REIClientPlugin {
|
||||
return EntryStack.of(VanillaEntryTypes.ITEM, value.asImmutableItemStack())
|
||||
}
|
||||
|
||||
val SKYBLOCK_ITEM_TYPE_ID = Identifier("firmament", "skyblockitems")
|
||||
val SKYBLOCK_ITEM_TYPE_ID = Identifier.of("firmament", "skyblockitems")
|
||||
}
|
||||
override fun registerTransferHandlers(registry: TransferHandlerRegistry) {
|
||||
registry.register(TransferHandler { context ->
|
||||
|
||||
@@ -20,7 +20,6 @@ import me.shedaniel.rei.api.client.gui.widgets.TooltipContext
|
||||
import me.shedaniel.rei.api.common.entry.EntryStack
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.item.TooltipType
|
||||
import net.minecraft.client.render.DiffuseLighting
|
||||
import net.minecraft.client.render.LightmapTextureManager
|
||||
import net.minecraft.client.render.OverlayTexture
|
||||
@@ -30,6 +29,7 @@ import net.minecraft.client.render.model.json.ModelTransformationMode
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.tooltip.TooltipType
|
||||
import moe.nea.firmament.rei.FirmamentReiPlugin.Companion.asItemEntry
|
||||
|
||||
object NEUItemEntryRenderer : EntryRenderer<SBItemStack>, BatchedEntryRenderer<SBItemStack, BakedModel> {
|
||||
|
||||
@@ -41,7 +41,7 @@ class SBMobDropRecipe(override val neuRecipe: NEUMobDropRecipe) : SBRecipe() {
|
||||
add(Widgets.createRecipeBase(bounds))
|
||||
val source = display.neuRecipe.render
|
||||
val entity = if (source.startsWith("@")) {
|
||||
EntityRenderer.constructEntity(Identifier(source.substring(1)))
|
||||
EntityRenderer.constructEntity(Identifier.of(source.substring(1)))
|
||||
} else {
|
||||
EntityRenderer.applyModifiers(source, listOf())
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ object CommonSoundEffects {
|
||||
}
|
||||
|
||||
fun playFailure() {
|
||||
playSound(Identifier("minecraft", "block.anvil.place"))
|
||||
playSound(Identifier.of("minecraft", "block.anvil.place"))
|
||||
}
|
||||
|
||||
fun playSuccess() {
|
||||
@@ -25,6 +25,6 @@ object CommonSoundEffects {
|
||||
}
|
||||
|
||||
fun playDing() {
|
||||
playSound(Identifier("minecraft", "entity.arrow.hit_player"))
|
||||
playSound(Identifier.of("minecraft", "entity.arrow.hit_player"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ object IdentifierSerializer : KSerializer<Identifier> {
|
||||
get() = SerialDescriptor("Identifier", delegateSerializer.descriptor)
|
||||
|
||||
override fun deserialize(decoder: Decoder): Identifier {
|
||||
return Identifier(decoder.decodeSerializableValue(delegateSerializer))
|
||||
return Identifier.of(decoder.decodeSerializableValue(delegateSerializer))
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: Identifier) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import moe.nea.firmament.util.json.DashlessUUIDSerializer
|
||||
@Serializable
|
||||
value class SkyblockId(val neuItem: String) {
|
||||
val identifier
|
||||
get() = Identifier("skyblockitem",
|
||||
get() = Identifier.of("skyblockitem",
|
||||
neuItem.lowercase().replace(";", "__")
|
||||
.replace(":", "___")
|
||||
.replace(illlegalPathRegex) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
package moe.nea.firmament.util.render
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import io.github.notenoughupdates.moulconfig.platform.next
|
||||
import org.joml.Matrix4f
|
||||
import net.minecraft.client.font.TextRenderer
|
||||
import net.minecraft.client.render.BufferRenderer
|
||||
@@ -80,22 +81,24 @@ class FacingThePlayerContext(val worldContext: RenderInWorldContext) {
|
||||
u2: Float, v2: Float,
|
||||
) {
|
||||
RenderSystem.setShaderTexture(0, texture)
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorTexProgram)
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexColorProgram)
|
||||
val hw = width / 2F
|
||||
val hh = height / 2F
|
||||
val matrix4f: Matrix4f = worldContext.matrixStack.peek().positionMatrix
|
||||
val buf = Tessellator.getInstance().buffer
|
||||
buf.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE)
|
||||
buf.fixedColor(255, 255, 255, 255)
|
||||
val buf = Tessellator.getInstance()
|
||||
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR)
|
||||
buf.vertex(matrix4f, -hw, -hh, 0F)
|
||||
.color(-1)
|
||||
.texture(u1, v1).next()
|
||||
buf.vertex(matrix4f, -hw, +hh, 0F)
|
||||
.color(-1)
|
||||
.texture(u1, v2).next()
|
||||
buf.vertex(matrix4f, +hw, +hh, 0F)
|
||||
.color(-1)
|
||||
.texture(u2, v2).next()
|
||||
buf.vertex(matrix4f, +hw, -hh, 0F)
|
||||
.color(-1)
|
||||
.texture(u2, v1).next()
|
||||
buf.unfixColor()
|
||||
BufferRenderer.drawWithGlobalProgram(buf.end())
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
package moe.nea.firmament.util.render
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import io.github.notenoughupdates.moulconfig.platform.next
|
||||
import org.joml.Matrix4f
|
||||
import org.joml.Vector2f
|
||||
import kotlin.math.atan2
|
||||
@@ -31,12 +32,10 @@ object RenderCircleProgress {
|
||||
v2: Float,
|
||||
) {
|
||||
RenderSystem.setShaderTexture(0, texture)
|
||||
RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() }
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexColorProgram)
|
||||
RenderSystem.enableBlend()
|
||||
val matrix: Matrix4f = drawContext.matrices.peek().positionMatrix
|
||||
val bufferBuilder = Tessellator.getInstance().buffer
|
||||
bufferBuilder.begin(DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR_TEXTURE)
|
||||
bufferBuilder.fixedColor(255, 255, 255, 255)
|
||||
val bufferBuilder = Tessellator.getInstance().begin(DrawMode.TRIANGLES, VertexFormats.POSITION_TEXTURE_COLOR)
|
||||
|
||||
val corners = listOf(
|
||||
Vector2f(0F, -1F),
|
||||
@@ -79,17 +78,19 @@ object RenderCircleProgress {
|
||||
bufferBuilder
|
||||
.vertex(matrix, second.x, second.y, 0F)
|
||||
.texture(lerp(u1, u2, ilerp(second.x)), lerp(v1, v2, ilerp(second.y)))
|
||||
.color(-1)
|
||||
.next()
|
||||
bufferBuilder
|
||||
.vertex(matrix, first.x, first.y, 0F)
|
||||
.texture(lerp(u1, u2, ilerp(first.x)), lerp(v1, v2, ilerp(first.y)))
|
||||
.color(-1)
|
||||
.next()
|
||||
bufferBuilder
|
||||
.vertex(matrix, 0F, 0F, 0F)
|
||||
.texture(lerp(u1, u2, ilerp(0F)), lerp(v1, v2, ilerp(0F)))
|
||||
.color(-1)
|
||||
.next()
|
||||
}
|
||||
bufferBuilder.unfixColor()
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end())
|
||||
RenderSystem.disableBlend()
|
||||
}
|
||||
|
||||
@@ -8,15 +8,16 @@
|
||||
package moe.nea.firmament.util.render
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import io.github.notenoughupdates.moulconfig.platform.next
|
||||
import java.lang.Math.pow
|
||||
import java.lang.Math.toRadians
|
||||
import org.joml.Matrix4f
|
||||
import org.joml.Vector3f
|
||||
import kotlin.math.tan
|
||||
import net.minecraft.client.gl.VertexBuffer
|
||||
import net.minecraft.client.render.BufferBuilder
|
||||
import net.minecraft.client.render.BufferRenderer
|
||||
import net.minecraft.client.render.Camera
|
||||
import net.minecraft.client.render.GameRenderer
|
||||
import net.minecraft.client.render.RenderTickCounter
|
||||
import net.minecraft.client.render.Tessellator
|
||||
import net.minecraft.client.render.VertexConsumerProvider
|
||||
import net.minecraft.client.render.VertexFormat
|
||||
@@ -28,7 +29,6 @@ import net.minecraft.util.Identifier
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import moe.nea.firmament.events.WorldRenderLastEvent
|
||||
import moe.nea.firmament.mixins.accessor.AccessorGameRenderer
|
||||
import moe.nea.firmament.util.FirmFormatters
|
||||
import moe.nea.firmament.util.MC
|
||||
|
||||
@@ -37,12 +37,9 @@ class RenderInWorldContext private constructor(
|
||||
private val tesselator: Tessellator,
|
||||
val matrixStack: MatrixStack,
|
||||
private val camera: Camera,
|
||||
private val tickDelta: Float,
|
||||
private val tickCounter: RenderTickCounter,
|
||||
val vertexConsumers: VertexConsumerProvider.Immediate,
|
||||
) {
|
||||
private val buffer = tesselator.buffer
|
||||
val effectiveFov = (MC.instance.gameRenderer as AccessorGameRenderer).getFov_firmament(camera, tickDelta, true)
|
||||
val effectiveFovScaleFactor = 1 / tan(toRadians(effectiveFov) / 2)
|
||||
|
||||
fun color(color: me.shedaniel.math.Color) {
|
||||
color(color.red / 255F, color.green / 255f, color.blue / 255f, color.alpha / 255f)
|
||||
@@ -56,8 +53,7 @@ class RenderInWorldContext private constructor(
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram)
|
||||
matrixStack.push()
|
||||
matrixStack.translate(blockPos.x.toFloat(), blockPos.y.toFloat(), blockPos.z.toFloat())
|
||||
buildCube(matrixStack.peek().positionMatrix, buffer)
|
||||
tesselator.draw()
|
||||
buildCube(matrixStack.peek().positionMatrix, tesselator)
|
||||
matrixStack.pop()
|
||||
}
|
||||
|
||||
@@ -125,8 +121,7 @@ class RenderInWorldContext private constructor(
|
||||
matrixStack.translate(vec3d.x, vec3d.y, vec3d.z)
|
||||
matrixStack.scale(size, size, size)
|
||||
matrixStack.translate(-.5, -.5, -.5)
|
||||
buildCube(matrixStack.peek().positionMatrix, buffer)
|
||||
tesselator.draw()
|
||||
buildCube(matrixStack.peek().positionMatrix, tesselator)
|
||||
matrixStack.pop()
|
||||
}
|
||||
|
||||
@@ -135,8 +130,7 @@ class RenderInWorldContext private constructor(
|
||||
matrixStack.push()
|
||||
RenderSystem.lineWidth(lineWidth / pow(camera.pos.squaredDistanceTo(blockPos.toCenterPos()), 0.25).toFloat())
|
||||
matrixStack.translate(blockPos.x.toFloat(), blockPos.y.toFloat(), blockPos.z.toFloat())
|
||||
buildWireFrameCube(matrixStack.peek(), buffer)
|
||||
tesselator.draw()
|
||||
buildWireFrameCube(matrixStack.peek(), tesselator)
|
||||
matrixStack.pop()
|
||||
}
|
||||
|
||||
@@ -152,8 +146,7 @@ class RenderInWorldContext private constructor(
|
||||
fun line(points: List<Vec3d>, lineWidth: Float = 10F) {
|
||||
RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram)
|
||||
RenderSystem.lineWidth(lineWidth)
|
||||
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES)
|
||||
buffer.fixedColor(255, 255, 255, 255)
|
||||
val buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES)
|
||||
|
||||
val matrix = matrixStack.peek()
|
||||
var lastNormal: Vector3f? = null
|
||||
@@ -170,9 +163,8 @@ class RenderInWorldContext private constructor(
|
||||
.normal(matrix, normal.x, normal.y, normal.z)
|
||||
.next()
|
||||
}
|
||||
buffer.unfixColor()
|
||||
|
||||
tesselator.draw()
|
||||
BufferRenderer.drawWithGlobalProgram(buffer.end())
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -191,16 +183,17 @@ class RenderInWorldContext private constructor(
|
||||
.normalize()
|
||||
buf.vertex(matrix.positionMatrix, i, j, k)
|
||||
.normal(matrix, normal.x, normal.y, normal.z)
|
||||
.color(-1)
|
||||
.next()
|
||||
buf.vertex(matrix.positionMatrix, x, y, z)
|
||||
.normal(matrix, normal.x, normal.y, normal.z)
|
||||
.color(-1)
|
||||
.next()
|
||||
}
|
||||
|
||||
|
||||
private fun buildWireFrameCube(matrix: MatrixStack.Entry, buf: BufferBuilder) {
|
||||
buf.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES)
|
||||
buf.fixedColor(255, 255, 255, 255)
|
||||
private fun buildWireFrameCube(matrix: MatrixStack.Entry, tessellator: Tessellator) {
|
||||
val buf = tessellator.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES)
|
||||
|
||||
for (i in 0..1) {
|
||||
for (j in 0..1) {
|
||||
@@ -211,12 +204,11 @@ class RenderInWorldContext private constructor(
|
||||
doLine(matrix, buf, i, j, 0F, i, j, 1F)
|
||||
}
|
||||
}
|
||||
buf.unfixColor()
|
||||
BufferRenderer.drawWithGlobalProgram(buf.end())
|
||||
}
|
||||
|
||||
private fun buildCube(matrix: Matrix4f, buf: BufferBuilder) {
|
||||
buf.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR)
|
||||
buf.fixedColor(255, 255, 255, 255)
|
||||
private fun buildCube(matrix: Matrix4f, tessellator: Tessellator) {
|
||||
val buf = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION)
|
||||
buf.vertex(matrix, 0.0F, 0.0F, 0.0F).next()
|
||||
buf.vertex(matrix, 0.0F, 0.0F, 1.0F).next()
|
||||
buf.vertex(matrix, 0.0F, 1.0F, 1.0F).next()
|
||||
@@ -253,7 +245,7 @@ class RenderInWorldContext private constructor(
|
||||
buf.vertex(matrix, 1.0F, 1.0F, 1.0F).next()
|
||||
buf.vertex(matrix, 0.0F, 1.0F, 1.0F).next()
|
||||
buf.vertex(matrix, 1.0F, 0.0F, 1.0F).next()
|
||||
buf.unfixColor()
|
||||
BufferRenderer.drawWithGlobalProgram(buf.end())
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +262,7 @@ class RenderInWorldContext private constructor(
|
||||
RenderSystem.renderThreadTesselator(),
|
||||
event.matrices,
|
||||
event.camera,
|
||||
event.tickDelta,
|
||||
event.tickCounter,
|
||||
event.vertexConsumers
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
|
||||
SPDX-FileCopyrightText: This texture is a derivative of textures from Minecraft by Mojang.
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
Reference in New Issue
Block a user