mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-23 04:57:58 +01:00
Cleaned up MixinRenderManager and made KillJoy happy
This will be the last commit on master until I can get this PR merged
This commit is contained in:
parent
df5d18d350
commit
1f68025252
4 changed files with 15 additions and 39 deletions
|
@ -3,7 +3,7 @@ package com.minelittlepony;
|
|||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.ducks.IRenderManager;
|
||||
import com.minelittlepony.mixin.MixinRenderManager;
|
||||
import com.minelittlepony.hdskins.gui.EntityPonyModel;
|
||||
import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
||||
import com.minelittlepony.model.player.PlayerModels;
|
||||
|
@ -56,13 +56,15 @@ public class PonyRenderManager {
|
|||
registerPlayerSkin(manager, PlayerModels.ALICORN);
|
||||
}
|
||||
|
||||
protected void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) {
|
||||
addPlayerSkin(manager, new RenderPonyPlayer(manager, false, playerModel));
|
||||
addPlayerSkin(manager, new RenderPonyPlayer(manager, true, playerModel));
|
||||
private void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) {
|
||||
addPlayerSkin(manager, false, playerModel);
|
||||
addPlayerSkin(manager, true, playerModel);
|
||||
}
|
||||
|
||||
public void addPlayerSkin(RenderManager manager, RenderPonyPlayer renderer) {
|
||||
((IRenderManager)manager).addPlayerSkin(renderer.skinId, renderer);
|
||||
private void addPlayerSkin(RenderManager manager, boolean slimArms, PlayerModels playerModel) {
|
||||
RenderPonyPlayer renderer = new RenderPonyPlayer(manager, slimArms, playerModel.getModel(slimArms));
|
||||
|
||||
((MixinRenderManager)manager).getSkinMap().put(playerModel.getId(slimArms), renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package com.minelittlepony.ducks;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
|
||||
public interface IRenderManager {
|
||||
/**
|
||||
* Registers a new player model to the underlying skinMap object.
|
||||
* @param key The key to identify it by.
|
||||
* @param render The renderer to add.
|
||||
*/
|
||||
void addPlayerSkin(String key, RenderPlayer render);
|
||||
}
|
|
@ -2,22 +2,14 @@ package com.minelittlepony.mixin;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import com.minelittlepony.ducks.IRenderManager;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
|
||||
@Mixin(RenderManager.class)
|
||||
public abstract class MixinRenderManager implements IRenderManager {
|
||||
@Shadow @Final
|
||||
private Map<String, RenderPlayer> skinMap;
|
||||
|
||||
@Override
|
||||
public void addPlayerSkin(String key, RenderPlayer render) {
|
||||
skinMap.put(key, render);
|
||||
}
|
||||
public interface MixinRenderManager {
|
||||
@Accessor
|
||||
Map<String, RenderPlayer> getSkinMap();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.render.player;
|
|||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.ducks.IPonyAnimationHolder;
|
||||
import com.minelittlepony.model.player.PlayerModels;
|
||||
import com.minelittlepony.model.ModelWrapper;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
@ -10,14 +10,8 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
|||
|
||||
public class RenderPonyPlayer extends RenderPonyBase {
|
||||
|
||||
/**
|
||||
* The id used to find this renderer in the player skin map.
|
||||
*/
|
||||
public final String skinId;
|
||||
|
||||
public RenderPonyPlayer(RenderManager renderManager, boolean useSmallArms, PlayerModels model) {
|
||||
super(renderManager, useSmallArms, model.getModel(useSmallArms));
|
||||
skinId = model.getId(useSmallArms);
|
||||
public RenderPonyPlayer(RenderManager renderManager, boolean useSmallArms, ModelWrapper model) {
|
||||
super(renderManager, useSmallArms, model);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue