mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Register networking response code when the mod is added to a server (also fix some client/server separation issues)
This commit is contained in:
parent
55bf4e209f
commit
b3acab046e
19 changed files with 161 additions and 84 deletions
|
@ -0,0 +1,46 @@
|
|||
package com.minelittlepony.api.events;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ClientChannel {
|
||||
private static final Logger LOGGER = LogManager.getLogger("MineLittlePony:Networking");
|
||||
|
||||
private static boolean registered;
|
||||
|
||||
public static void bootstrap() {
|
||||
ClientLoginConnectionEvents.INIT.register((handler, client) -> {
|
||||
registered = false;
|
||||
});
|
||||
|
||||
ClientPlayNetworking.registerGlobalReceiver(CommonChannel.PonyDataRequest.ID, (packet, context) -> {
|
||||
registered = true;
|
||||
LOGGER.info("Server has just consented");
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public static boolean broadcastPonyData(PonyData packet) {
|
||||
if (!isRegistered()) {
|
||||
return false;
|
||||
}
|
||||
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
|
||||
throw new RuntimeException("Client packet send called by the server");
|
||||
}
|
||||
|
||||
ClientPlayNetworking.send(new CommonChannel.PonyDataPayload(packet));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,7 @@
|
|||
package com.minelittlepony.api.events;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.networking.v1.*;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.codec.PacketCodec;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
|
@ -16,17 +12,10 @@ import org.apache.logging.log4j.Logger;
|
|||
|
||||
import com.minelittlepony.api.pony.PonyData;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class Channel {
|
||||
public class CommonChannel {
|
||||
private static final Logger LOGGER = LogManager.getLogger("MineLittlePony:Networking");
|
||||
|
||||
private static boolean registered;
|
||||
|
||||
public static void bootstrap() {
|
||||
ClientLoginConnectionEvents.INIT.register((handler, client) -> {
|
||||
registered = false;
|
||||
});
|
||||
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
|
||||
LOGGER.info("Sending consent packet to " + handler.getPlayer().getName().getString());
|
||||
sender.sendPacket(PonyDataRequest.INSTANCE);
|
||||
|
@ -36,11 +25,6 @@ public class Channel {
|
|||
PayloadTypeRegistry.playS2C().register(PonyDataPayload.ID, PonyDataPayload.CODEC);
|
||||
PayloadTypeRegistry.playC2S().register(PonyDataPayload.ID, PonyDataPayload.CODEC);
|
||||
|
||||
ClientPlayNetworking.registerGlobalReceiver(PonyDataRequest.ID, (packet, context) -> {
|
||||
registered = true;
|
||||
LOGGER.info("Server has just consented");
|
||||
});
|
||||
|
||||
ServerPlayNetworking.registerGlobalReceiver(PonyDataPayload.ID, (packet, context) -> {
|
||||
context.player().server.execute(() -> {
|
||||
PonyDataCallback.EVENT.invoker().onPonyDataAvailable(context.player(), packet.data(), EnvType.SERVER);
|
||||
|
@ -48,22 +32,6 @@ public class Channel {
|
|||
});
|
||||
}
|
||||
|
||||
public static boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public static boolean broadcastPonyData(PonyData packet) {
|
||||
if (!isRegistered()) {
|
||||
return false;
|
||||
}
|
||||
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
|
||||
throw new RuntimeException("Client packet send called by the server");
|
||||
}
|
||||
|
||||
ClientPlayNetworking.send(new PonyDataPayload(packet));
|
||||
return true;
|
||||
}
|
||||
|
||||
record PonyDataPayload(PonyData data) implements CustomPayload {
|
||||
public static final Id<PonyDataPayload> ID = new Id<>(Identifier.of("minelittlepony", "pony_data"));
|
||||
public static final PacketCodec<PacketByteBuf, PonyDataPayload> CODEC = CustomPayload.codecOf(
|
||||
|
@ -79,7 +47,7 @@ public class Channel {
|
|||
|
||||
record PonyDataRequest() implements CustomPayload {
|
||||
public static final PonyDataRequest INSTANCE = new PonyDataRequest();
|
||||
private static final Id<PonyDataRequest> ID = new Id<>(Identifier.of("minelittlepony", "request_pony_data"));
|
||||
public static final Id<PonyDataRequest> ID = new Id<>(Identifier.of("minelittlepony", "request_pony_data"));
|
||||
public static final PacketCodec<PacketByteBuf, PonyDataRequest> CODEC = PacketCodec.unit(INSTANCE);
|
||||
|
||||
@Override
|
|
@ -169,7 +169,7 @@ public class ModelAttributes {
|
|||
}
|
||||
isLeftHanded = entity.getMainArm() == Arm.LEFT;
|
||||
isHorsey = PonyConfig.getInstance().horsieMode.get();
|
||||
featureSkins = SkinsProxy.instance.getAvailableSkins(entity);
|
||||
featureSkins = SkinsProxy.getInstance().getAvailableSkins(entity);
|
||||
mainArm = entity.getMainArm();
|
||||
activeHand = entity.getActiveHand();
|
||||
itemUseTime = entity.getItemUseTimeLeft();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.api.pony;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.SkinTextures;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -10,14 +12,15 @@ import com.minelittlepony.api.pony.meta.Race;
|
|||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public final class DefaultPonySkinHelper {
|
||||
public static final Identifier STEVE = id("textures/entity/player/wide/steve_pony.png");
|
||||
public static final Identifier STEVE = Pony.id("textures/entity/player/wide/steve_pony.png");
|
||||
|
||||
public static final Identifier SEAPONY_SKIN_TYPE_ID = id("seapony");
|
||||
public static final Identifier NIRIK_SKIN_TYPE_ID = id("nirik");
|
||||
public static final Identifier SEAPONY_SKIN_TYPE_ID = Pony.id("seapony");
|
||||
public static final Identifier NIRIK_SKIN_TYPE_ID = Pony.id("nirik");
|
||||
|
||||
private static final Function<SkinTextures, SkinTextures> SKINS = Util.memoize(original -> new SkinTextures(
|
||||
id(original.texture().getPath().replace(".png", "_pony.png")),
|
||||
Pony.id(original.texture().getPath().replace(".png", "_pony.png")),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -25,10 +28,6 @@ public final class DefaultPonySkinHelper {
|
|||
false
|
||||
));
|
||||
|
||||
public static Identifier id(String name) {
|
||||
return Identifier.of("minelittlepony", name);
|
||||
}
|
||||
|
||||
public static SkinTextures getTextures(SkinTextures original) {
|
||||
return SKINS.apply(original);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,13 @@ public record Pony (
|
|||
return PonyManager.Instance.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an identifier for the Mine Little Pony namespace
|
||||
*/
|
||||
public static Identifier id(String name) {
|
||||
return Identifier.of("minelittlepony", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata associated with this pony's model texture.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.api.pony;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -18,10 +20,11 @@ import java.util.function.Predicate;
|
|||
* Other options are water (seaponies that go shoop-de-doo)
|
||||
* And Niriks (the burning form of kirins)
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
public record PonyForm(Identifier id, Predicate<PlayerEntity> shouldApply, RendererFactory<?> factory) {
|
||||
public static final Identifier DEFAULT = DefaultPonySkinHelper.id("land");
|
||||
public static final Identifier SEAPONY = DefaultPonySkinHelper.id("seapony");
|
||||
public static final Identifier NIRIK = DefaultPonySkinHelper.id("nirik");
|
||||
public static final Identifier DEFAULT = Pony.id("land");
|
||||
public static final Identifier SEAPONY = Pony.id("seapony");
|
||||
public static final Identifier NIRIK = Pony.id("nirik");
|
||||
|
||||
public static final List<Identifier> VALUES = new ArrayList<>();
|
||||
public static final Map<Identifier, PonyForm> REGISTRY = new HashMap<>();
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Optional;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
|
@ -92,7 +91,7 @@ public final class PonyPosture {
|
|||
}
|
||||
return Pony.getManager().getPony(entity).filter(pony -> {
|
||||
return (pony.race() == Race.SEAPONY
|
||||
|| (entity instanceof AbstractClientPlayerEntity player && SkinsProxy.instance.getSkin(DefaultPonySkinHelper.SEAPONY_SKIN_TYPE_ID, player).isPresent())
|
||||
|| (entity instanceof PlayerEntity player && SkinsProxy.getInstance().getSkin(DefaultPonySkinHelper.SEAPONY_SKIN_TYPE_ID, player).isPresent())
|
||||
);
|
||||
}).isPresent();
|
||||
}
|
||||
|
@ -103,7 +102,7 @@ public final class PonyPosture {
|
|||
}
|
||||
return Pony.getManager().getPony(entity).filter(pony -> {
|
||||
return (pony.race() == Race.KIRIN
|
||||
&& (entity instanceof AbstractClientPlayerEntity player && SkinsProxy.instance.getSkin(DefaultPonySkinHelper.NIRIK_SKIN_TYPE_ID, player).isPresent())
|
||||
&& (entity instanceof PlayerEntity player && SkinsProxy.getInstance().getSkin(DefaultPonySkinHelper.NIRIK_SKIN_TYPE_ID, player).isPresent())
|
||||
);
|
||||
}).isPresent();
|
||||
}
|
||||
|
|
|
@ -1,28 +1,39 @@
|
|||
package com.minelittlepony.api.pony;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.texture.PlayerSkinProvider;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* Proxy handler for getting player skin data from HDSkins
|
||||
*/
|
||||
public class SkinsProxy {
|
||||
public static SkinsProxy instance = new SkinsProxy();
|
||||
public static SkinsProxy INSTANCE = new SkinsProxy();
|
||||
private static final SkinsProxy DEFAULT = INSTANCE;
|
||||
|
||||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider();
|
||||
return skins.getSkinTextures(profile).texture();
|
||||
public static SkinsProxy getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public Optional<Identifier> getSkin(Identifier skinTypeId, AbstractClientPlayerEntity player) {
|
||||
protected SkinsProxy() {
|
||||
if (INSTANCE == DEFAULT) {
|
||||
INSTANCE = this;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Optional<Identifier> getSkin(Identifier skinTypeId, PlayerEntity player) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.api.pony.meta;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
|
||||
import com.minelittlepony.api.pony.DefaultPonySkinHelper;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
@ -11,14 +11,14 @@ import java.util.stream.Collectors;
|
|||
|
||||
public enum Wearable implements TValue<Wearable> {
|
||||
NONE (0x00, null),
|
||||
CROWN (0x16, DefaultPonySkinHelper.id("textures/models/crown.png")),
|
||||
MUFFIN (0x32, DefaultPonySkinHelper.id("textures/models/muffin.png")),
|
||||
CROWN (0x16, Pony.id("textures/models/crown.png")),
|
||||
MUFFIN (0x32, Pony.id("textures/models/muffin.png")),
|
||||
HAT (0x64, Identifier.ofVanilla("textures/entity/witch.png")),
|
||||
ANTLERS (0x96, DefaultPonySkinHelper.id("textures/models/antlers.png")),
|
||||
SADDLE_BAGS_LEFT (0xC6, DefaultPonySkinHelper.id("textures/models/saddlebags.png")),
|
||||
SADDLE_BAGS_RIGHT (0xC7, DefaultPonySkinHelper.id("textures/models/saddlebags.png")),
|
||||
SADDLE_BAGS_BOTH (0xC8, DefaultPonySkinHelper.id("textures/models/saddlebags.png")),
|
||||
STETSON (0xFA, DefaultPonySkinHelper.id("textures/models/stetson.png"));
|
||||
ANTLERS (0x96, Pony.id("textures/models/antlers.png")),
|
||||
SADDLE_BAGS_LEFT (0xC6, Pony.id("textures/models/saddlebags.png")),
|
||||
SADDLE_BAGS_RIGHT (0xC7, Pony.id("textures/models/saddlebags.png")),
|
||||
SADDLE_BAGS_BOTH (0xC8, Pony.id("textures/models/saddlebags.png")),
|
||||
STETSON (0xFA, Pony.id("textures/models/stetson.png"));
|
||||
|
||||
private int triggerValue;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public enum Wearable implements TValue<Wearable> {
|
|||
|
||||
Wearable(int pixel, Identifier texture) {
|
||||
triggerValue = pixel;
|
||||
id = DefaultPonySkinHelper.id(name().toLowerCase(Locale.ROOT));
|
||||
id = Pony.id(name().toLowerCase(Locale.ROOT));
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.api.pony.SkinsProxy;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class ClientSkinsProxy extends SkinsProxy {
|
||||
@Nullable
|
||||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
return MinecraftClient.getInstance().getSkinProvider().getSkinTextures(profile).texture();
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.events.Channel;
|
||||
import com.minelittlepony.api.events.ClientChannel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.armour.ArmourTextureResolver;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
|
@ -89,10 +89,12 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
ClientTickEvents.END_CLIENT_TICK.register(this::onTick);
|
||||
ScreenInitCallback.EVENT.register(this::onScreenInit);
|
||||
|
||||
new ClientSkinsProxy();
|
||||
|
||||
config.load();
|
||||
config.onChangedExternally(c -> initialized = false);
|
||||
|
||||
Channel.bootstrap();
|
||||
ClientChannel.bootstrap();
|
||||
ModelType.bootstrap();
|
||||
|
||||
FabricLoader.getInstance().getEntrypoints("minelittlepony", ClientModInitializer.class).forEach(ClientModInitializer::onInitializeClient);
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.minelittlepony.hdskins.client.gui.player.DummyPlayer;
|
|||
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins.PlayerSkin;
|
||||
import com.minelittlepony.hdskins.client.profile.SkinLoader.ProvidedSkins;
|
||||
import com.minelittlepony.hdskins.profile.SkinType;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -25,6 +24,7 @@ import net.minecraft.client.MinecraftClient;
|
|||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
@ -33,7 +33,7 @@ import com.minelittlepony.client.*;
|
|||
/**
|
||||
* All the interactions with HD Skins.
|
||||
*/
|
||||
public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
||||
public class MineLPHDSkins extends ClientSkinsProxy implements ClientModInitializer {
|
||||
|
||||
static SkinType seaponySkinType;
|
||||
static SkinType nirikSkinType;
|
||||
|
@ -42,7 +42,6 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
SkinsProxy.instance = this;
|
||||
PonySettingsScreen.buttonFactory = this::renderOption;
|
||||
|
||||
seaponySkinType = SkinType.register(DefaultPonySkinHelper.SEAPONY_SKIN_TYPE_ID, Items.COD_BUCKET.getDefaultStack());
|
||||
|
@ -92,8 +91,13 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Optional<Identifier> getSkin(Identifier skinTypeId, AbstractClientPlayerEntity player) {
|
||||
return SkinType.REGISTRY.getOrEmpty(skinTypeId).flatMap(type -> getSkin(type, player));
|
||||
public Optional<Identifier> getSkin(Identifier skinTypeId, PlayerEntity player) {
|
||||
if (player instanceof AbstractClientPlayerEntity clientPlayer) {
|
||||
return SkinType.REGISTRY.getOrEmpty(skinTypeId).flatMap(type -> getSkin(type, clientPlayer));
|
||||
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Set<Identifier> getAvailableSkins(Entity entity) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.events.Channel;
|
||||
import com.minelittlepony.api.events.ClientChannel;
|
||||
import com.minelittlepony.api.events.PonyDataCallback;
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.pony.Pony;
|
||||
|
@ -177,9 +177,9 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
@Nullable
|
||||
PlayerEntity clientPlayer = MinecraftClient.getInstance().player;
|
||||
|
||||
if (Channel.isRegistered() && pony.compareTo(lastTransmittedPony) != 0) {
|
||||
if (ClientChannel.isRegistered() && pony.compareTo(lastTransmittedPony) != 0) {
|
||||
if (clientPlayer != null && (Objects.equals(player, clientPlayer) || Objects.equals(player.getGameProfile(), clientPlayer.getGameProfile()))) {
|
||||
if (Channel.broadcastPonyData(pony.metadata())) {
|
||||
if (ClientChannel.broadcastPonyData(pony.metadata())) {
|
||||
lastTransmittedPony = pony;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class PlayerPonySkull implements ISkull {
|
|||
renderingEars = profile != null && "deadmau5".equals(profile.gameProfile().getName());
|
||||
|
||||
if (profile != null) {
|
||||
Identifier skin = SkinsProxy.instance.getSkinTexture(profile.gameProfile());
|
||||
Identifier skin = SkinsProxy.getInstance().getSkinTexture(profile.gameProfile());
|
||||
|
||||
if (skin != null) {
|
||||
return skin;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class FormChangingPlayerPonyRenderer extends PlayerPonyRenderer {
|
|||
@Override
|
||||
public Identifier getTexture(AbstractClientPlayerEntity player) {
|
||||
if (transformed) {
|
||||
return SkinsProxy.instance.getSkin(alternateFormSkinId, player).orElseGet(() -> super.getTexture(player));
|
||||
return SkinsProxy.getInstance().getSkin(alternateFormSkinId, player).orElseGet(() -> super.getTexture(player));
|
||||
}
|
||||
return super.getTexture(player);
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements PonyRend
|
|||
|
||||
@Override
|
||||
public Identifier getDefaultTexture(AbstractClientPlayerEntity entity, Wearable wearable) {
|
||||
return SkinsProxy.instance.getSkin(wearable.getId(), entity).orElseGet(() -> {
|
||||
return SkinsProxy.getInstance().getSkin(wearable.getId(), entity).orElseGet(() -> {
|
||||
if (wearable.isSaddlebags() && getInternalRenderer().getModels().body().getRace().supportsLegacySaddlebags()) {
|
||||
return getTexture(entity);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class PlayerTextureSupplier {
|
|||
Function<String, CompletableFuture<Identifier>> customNameCache = Util.memoize(name -> {
|
||||
return SkullBlockEntity.fetchProfileByName(name).thenApply(profile -> {
|
||||
return profile
|
||||
.map(p -> SkinsProxy.instance.getSkinTexture(p))
|
||||
.map(p -> SkinsProxy.getInstance().getSkinTexture(p))
|
||||
.filter(skin -> !Pony.getManager().getPony(skin).race().isHuman())
|
||||
.orElse(null);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.minelittlepony.server;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.events.CommonChannel;
|
||||
|
||||
public class MineLittlePonyServer implements ModInitializer {
|
||||
|
||||
public static Identifier id(String name) {
|
||||
return Identifier.of("minelittlepony", name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
CommonChannel.bootstrap();
|
||||
}
|
||||
|
||||
}
|
|
@ -15,8 +15,11 @@
|
|||
"license": "MIT",
|
||||
"icon": "minelp_logo.png",
|
||||
"accessWidener": "minelp.aw",
|
||||
"environment": "client",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.minelittlepony.server.MineLittlePonyServer"
|
||||
],
|
||||
"client": [
|
||||
"com.minelittlepony.client.MineLittlePony"
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue