mirror of
https://github.com/Pridecraft-Studios/joy.git
synced 2025-08-03 06:26:00 -04:00
fix: SplashUtil now lists contributors again
This commit is contained in:
parent
9a5665cfed
commit
bfe4e236e8
@ -1,35 +0,0 @@
|
|||||||
package gay.pridecraft.joy.fabric.client.mixin.self;
|
|
||||||
|
|
||||||
import gay.pridecraft.joy.client.SplashUtil;
|
|
||||||
import gay.pridecraft.joy.fabric.FabricUtil;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ampflower
|
|
||||||
* @since 1.0.0
|
|
||||||
**/
|
|
||||||
@Mixin(SplashUtil.class)
|
|
||||||
public class MixinSplashUtil {
|
|
||||||
/**
|
|
||||||
* @author Ampflower
|
|
||||||
* @reason Quick & dirty hack.
|
|
||||||
*/
|
|
||||||
@Overwrite(remap = false)
|
|
||||||
private static List<String> makeContributors() {
|
|
||||||
final var metadata = FabricUtil.joyContainer.getMetadata();
|
|
||||||
|
|
||||||
final var authors = metadata.getAuthors()
|
|
||||||
.stream()
|
|
||||||
.map(person -> "Joy, made by " + person.getName() + "!");
|
|
||||||
|
|
||||||
final var contributors = metadata.getContributors()
|
|
||||||
.stream()
|
|
||||||
.map(person -> "Joy, aided by " + person.getName() + "!");
|
|
||||||
|
|
||||||
return Stream.concat(authors, contributors).toList();
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ import gay.pridecraft.joy.JoyUtil;
|
|||||||
import gay.pridecraft.joy.Pivot;
|
import gay.pridecraft.joy.Pivot;
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||||
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
|
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
|
||||||
|
import net.fabricmc.loader.api.metadata.Person;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.particle.SimpleParticleType;
|
import net.minecraft.particle.SimpleParticleType;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
@ -12,6 +13,8 @@ import net.minecraft.registry.RegistryKey;
|
|||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ampflower
|
* @author Ampflower
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
@ -38,4 +41,14 @@ public class FabricPivot implements Pivot {
|
|||||||
public SimpleParticleType createSimpleParticle() {
|
public SimpleParticleType createSimpleParticle() {
|
||||||
return FabricParticleTypes.simple();
|
return FabricParticleTypes.simple();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> authors() {
|
||||||
|
return FabricUtil.joyContainer.getMetadata().getAuthors().stream().map(Person::getName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> contributors() {
|
||||||
|
return FabricUtil.joyContainer.getMetadata().getContributors().stream().map(Person::getName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package gay.pridecraft.joy.client;
|
|||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import gay.pridecraft.joy.JoyUtil;
|
import gay.pridecraft.joy.JoyUtil;
|
||||||
|
import gay.pridecraft.joy.Pivot;
|
||||||
import net.minecraft.resource.ResourceManager;
|
import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -46,7 +47,13 @@ public final class SplashUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> makeContributors() {
|
private static List<String> makeContributors() {
|
||||||
return List.of();
|
final var authors = Pivot.INSTANCE.authors()
|
||||||
|
.map(person -> "Joy, made by " + person + "!");
|
||||||
|
|
||||||
|
final var contributors = Pivot.INSTANCE.contributors()
|
||||||
|
.map(person -> "Joy, aided by " + person + "!");
|
||||||
|
|
||||||
|
return Stream.concat(authors, contributors).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> prepare(ResourceManager manager) {
|
public static List<String> prepare(ResourceManager manager) {
|
||||||
|
@ -11,6 +11,8 @@ import net.minecraft.registry.RegistryKey;
|
|||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ampflower
|
* @author Ampflower
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
@ -38,4 +40,14 @@ public class VanillaPivot implements Pivot {
|
|||||||
public SimpleParticleType createSimpleParticle() {
|
public SimpleParticleType createSimpleParticle() {
|
||||||
return FabricParticleTypes.simple();
|
return FabricParticleTypes.simple();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> authors() {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> contributors() {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import net.minecraft.registry.RegistryKey;
|
|||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +42,10 @@ public interface Pivot {
|
|||||||
return INSTANCE.createSimpleParticle();
|
return INSTANCE.createSimpleParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream<String> authors();
|
||||||
|
|
||||||
|
Stream<String> contributors();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
static <V> Registry<V> getRegistry(RegistryKey<Registry<V>> key) {
|
static <V> Registry<V> getRegistry(RegistryKey<Registry<V>> key) {
|
||||||
return (Registry<V>) Registries.REGISTRIES.getOrEmpty(key.getValue()).orElseThrow();
|
return (Registry<V>) Registries.REGISTRIES.getOrEmpty(key.getValue()).orElseThrow();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user