Cleanup
This commit is contained in:
parent
dbeeb77fc8
commit
4f24b8eee5
@ -31,11 +31,11 @@ import me.braydon.mc.model.skin.Skin;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic 2D renderer for a {@link ISkinPart.Basic#BODY}.
|
* A basic 2D renderer for a {@link ISkinPart.Custom#BODY}.
|
||||||
*
|
*
|
||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
public final class BodySkinPartRenderer extends SkinRenderer<ISkinPart.Basic> {
|
public final class BodySkinPartRenderer extends SkinRenderer<ISkinPart.Custom> {
|
||||||
public static final BodySkinPartRenderer INSTANCE = new BodySkinPartRenderer();
|
public static final BodySkinPartRenderer INSTANCE = new BodySkinPartRenderer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,7 @@ public final class BodySkinPartRenderer extends SkinRenderer<ISkinPart.Basic> {
|
|||||||
* @return the rendered skin part
|
* @return the rendered skin part
|
||||||
*/
|
*/
|
||||||
@Override @NonNull
|
@Override @NonNull
|
||||||
public BufferedImage render(@NonNull Skin skin, @NonNull ISkinPart.Basic part, boolean overlays, int size) {
|
public BufferedImage render(@NonNull Skin skin, @NonNull ISkinPart.Custom part, boolean overlays, int size) {
|
||||||
return getVanillaSkinPart(skin, ISkinPart.Vanilla.FACE, size);
|
return getVanillaSkinPart(skin, ISkinPart.Vanilla.FACE, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,12 +33,12 @@ import java.awt.geom.AffineTransform;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A isometric 3D renderer for a {@link ISkinPart.Isometric}.
|
* A isometric 3D renderer for a {@link ISkinPart.Custom#HEAD}.
|
||||||
*
|
*
|
||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
public final class IsometricSkinPartRenderer extends SkinRenderer<ISkinPart.Isometric> {
|
public final class IsometricHeadSkinPartRenderer extends SkinRenderer<ISkinPart.Custom> {
|
||||||
public static final IsometricSkinPartRenderer INSTANCE = new IsometricSkinPartRenderer();
|
public static final IsometricHeadSkinPartRenderer INSTANCE = new IsometricHeadSkinPartRenderer();
|
||||||
|
|
||||||
private static final double SKEW_A = 26D / 45D; // 0.57777777
|
private static final double SKEW_A = 26D / 45D; // 0.57777777
|
||||||
private static final double SKEW_B = SKEW_A * 2D; // 1.15555555
|
private static final double SKEW_B = SKEW_A * 2D; // 1.15555555
|
||||||
@ -58,7 +58,7 @@ public final class IsometricSkinPartRenderer extends SkinRenderer<ISkinPart.Isom
|
|||||||
* @return the rendered skin part
|
* @return the rendered skin part
|
||||||
*/
|
*/
|
||||||
@Override @NonNull
|
@Override @NonNull
|
||||||
public BufferedImage render(@NonNull Skin skin, @NonNull ISkinPart.Isometric part, boolean overlays, int size) {
|
public BufferedImage render(@NonNull Skin skin, @NonNull ISkinPart.Custom part, boolean overlays, int size) {
|
||||||
double scale = (size / 8D) / 2.5;
|
double scale = (size / 8D) / 2.5;
|
||||||
double zOffset = scale * 3.5D;
|
double zOffset = scale * 3.5D;
|
||||||
double xOffset = scale * 2D;
|
double xOffset = scale * 2D;
|
@ -26,7 +26,7 @@ package me.braydon.mc.model.skin;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
import me.braydon.mc.common.renderer.SkinRenderer;
|
import me.braydon.mc.common.renderer.SkinRenderer;
|
||||||
import me.braydon.mc.common.renderer.impl.BodySkinPartRenderer;
|
import me.braydon.mc.common.renderer.impl.BodySkinPartRenderer;
|
||||||
import me.braydon.mc.common.renderer.impl.IsometricSkinPartRenderer;
|
import me.braydon.mc.common.renderer.impl.IsometricHeadSkinPartRenderer;
|
||||||
import me.braydon.mc.common.renderer.impl.VanillaSkinPartRenderer;
|
import me.braydon.mc.common.renderer.impl.VanillaSkinPartRenderer;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@ -37,7 +37,7 @@ import java.awt.image.BufferedImage;
|
|||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
public interface ISkinPart {
|
public interface ISkinPart {
|
||||||
Enum<?>[][] TYPES = { Vanilla.values(), Basic.values(), Isometric.values() };
|
Enum<?>[][] TYPES = { Vanilla.values(), Custom.values() };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of this part.
|
* Get the name of this part.
|
||||||
@ -170,19 +170,17 @@ public interface ISkinPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic part of a skin.
|
* A custom part of a skin.
|
||||||
* <p>
|
|
||||||
* These parts have custom renderers!
|
|
||||||
* </p>
|
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor @Getter
|
@AllArgsConstructor @Getter
|
||||||
enum Basic implements ISkinPart {
|
enum Custom implements ISkinPart {
|
||||||
|
HEAD(IsometricHeadSkinPartRenderer.INSTANCE),
|
||||||
BODY(BodySkinPartRenderer.INSTANCE);
|
BODY(BodySkinPartRenderer.INSTANCE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The custom renderer to use for this part.
|
* The custom renderer to use for this part.
|
||||||
*/
|
*/
|
||||||
@NonNull private final SkinRenderer<Basic> renderer;
|
@NonNull private final SkinRenderer<Custom> renderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a part of a skin.
|
* Render a part of a skin.
|
||||||
@ -197,24 +195,4 @@ public interface ISkinPart {
|
|||||||
return renderer.render(skin, this, overlays, size);
|
return renderer.render(skin, this, overlays, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A isometric part of a skin.
|
|
||||||
*/
|
|
||||||
enum Isometric implements ISkinPart {
|
|
||||||
HEAD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render a part of a skin.
|
|
||||||
*
|
|
||||||
* @param skin the skin to render the part for
|
|
||||||
* @param overlays whether to render overlays
|
|
||||||
* @param size the size to scale the skin part to
|
|
||||||
* @return the rendered skin part
|
|
||||||
*/
|
|
||||||
@Override @NonNull
|
|
||||||
public BufferedImage render(@NonNull Skin skin, boolean overlays, int size) {
|
|
||||||
return IsometricSkinPartRenderer.INSTANCE.render(skin, this, overlays, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -31,7 +31,6 @@ import me.braydon.mc.model.Player;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A skin for a {@link Player}.
|
* A skin for a {@link Player}.
|
||||||
|
Loading…
Reference in New Issue
Block a user