Skip to content

Commit

Permalink
Further clean up pony mod integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed May 16, 2024
1 parent ae839fc commit c696a8f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.minelittlepony.bigpony.BigPony;
import com.minelittlepony.bigpony.Scaled;
import com.minelittlepony.bigpony.Scaling;
import com.minelittlepony.bigpony.minelittlepony.PresetDetector;
import com.minelittlepony.common.client.gui.GameGui;
import com.minelittlepony.common.client.gui.ScrollContainer;
import com.minelittlepony.common.client.gui.element.AbstractSlider;
Expand Down Expand Up @@ -128,23 +127,9 @@ private void rebuildContent() {
.setTextFormat(format("minebp.camera.distance"))
.setEnabled(allowCamera && allowScaling);

Toggle visual;
content.addButton(visual = new Toggle(left, top += 30, !bigPony.isVisual()))
content.addButton(new Toggle(left, top += 30, !bigPony.isVisual()))
.onChange(v -> {
bigPony.setVisual(!v);
if (v) {
visual.setEnabled(false);
PresetDetector.getInstance().detectPreset(client.getSession().getProfile(), bigPony).handle((skin, ex) -> {
visual.setEnabled(true);
xSize.setValue(bigPony.getScale().x);
ySize.setValue(bigPony.getScale().y);
zSize.setValue(bigPony.getScale().z);
height.setValue(bigPony.getCamera().height);
distance.setValue(bigPony.getCamera().distance);
tick();
return null;
});
}
tick();
return v;
})
Expand Down
31 changes: 0 additions & 31 deletions src/main/java/com/minelittlepony/bigpony/hdskins/Main.java

This file was deleted.

30 changes: 0 additions & 30 deletions src/main/java/com/minelittlepony/bigpony/hdskins/SkinDetecter.java

This file was deleted.

33 changes: 7 additions & 26 deletions src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
package com.minelittlepony.bigpony.minelittlepony;

import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.IPonyData;
import com.minelittlepony.api.pony.meta.Size;
import com.minelittlepony.api.pony.network.fabric.PonyDataCallback;
import com.minelittlepony.bigpony.*;
import com.minelittlepony.bigpony.client.BigPonyClient;
import com.minelittlepony.bigpony.hdskins.SkinDetecter;
import com.mojang.authlib.GameProfile;

import java.util.concurrent.CompletableFuture;

import com.minelittlepony.api.config.PonyConfig;
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;

public class Main extends PresetDetector implements ClientModInitializer {

Expand All @@ -35,7 +27,13 @@ public void onInitializeClient() {
if (!BigPony.getInstance().getScaling().isVisual()
&& env == EnvType.CLIENT
&& BigPonyClient.isClientPlayer(sender)) {
applyPreset(IPony.getManager().getPony(sender).metadata(), ((Scaled)sender).getScaling());
Scaling into = ((Scaled)sender).getScaling();
Size size = data.getSize();
boolean fillyCam = PonyConfig.getInstance().fillycam.get();
PonyConfig.getInstance().fillycam.set(true);
into.setScale(new Triple(size.getScaleFactor()));
into.setCamera(new Cam(size.getEyeDistanceFactor(), size.getEyeHeightFactor()));
PonyConfig.getInstance().fillycam.set(fillyCam);
}
});
}
Expand All @@ -49,21 +47,4 @@ public boolean isFillyCam() {
public boolean isPony(PlayerEntity player) {
return !IPony.getManager().getPony(player).race().isHuman();
}

@Override
public CompletableFuture<Identifier> detectPreset(GameProfile profile, Scaling into) {
return SkinDetecter.getInstance().loadSkin(profile).thenApplyAsync(skin -> {
applyPreset(IPony.getManager().getPony(skin).metadata(), into);
return skin;
}, MinecraftClient.getInstance());
}

private void applyPreset(IPonyData data, Scaling into) {
Size size = data.getSize();
boolean fillyCam = PonyConfig.getInstance().fillycam.get();
PonyConfig.getInstance().fillycam.set(true);
into.setScale(new Triple(size.getScaleFactor()));
into.setCamera(new Cam(size.getEyeDistanceFactor(), size.getEyeHeightFactor()));
PonyConfig.getInstance().fillycam.set(fillyCam);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package com.minelittlepony.bigpony.minelittlepony;

import java.util.concurrent.CompletableFuture;

import com.minelittlepony.bigpony.Scaling;
import com.mojang.authlib.GameProfile;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;

public class PresetDetector {
static PresetDetector INSTANCE = new PresetDetector();
Expand All @@ -24,8 +18,4 @@ public boolean isFillyCam() {
public boolean isPony(PlayerEntity player) {
return false;
}

public CompletableFuture<Identifier> detectPreset(GameProfile profile, Scaling into) {
return CompletableFuture.failedFuture(null);
}
}
10 changes: 5 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
],
"minelittlepony": [
"com.minelittlepony.bigpony.minelittlepony.Main"
],
"hdskins": [
"com.minelittlepony.bigpony.hdskins.Main"
]
},
"mixins": [
Expand All @@ -47,8 +44,11 @@
"custom": {
"modmenu": {
"links": {
"modmenu.discord": "https://discord.gg/zKSZ8Mg"
}
"modmenu.discord": "https://discord.gg/zKSZ8Mg",
"modmenu.github_releases": "https://github.com/MineLittlePony/BigPony/releases",
"modmenu.modrinth": "https://modrinth.com/mod/big-pony"
},
"update_checker": true
}
}
}

0 comments on commit c696a8f

Please sign in to comment.