Settings, imports, and naming changes

This commit is contained in:
Sollace 2019-05-28 10:26:26 +02:00
parent cae1f490fb
commit f1b1e412dc
26 changed files with 136 additions and 129 deletions

View file

@ -12,7 +12,7 @@ import com.minelittlepony.common.client.gui.element.Slider;
import com.minelittlepony.common.client.gui.element.Toggle; import com.minelittlepony.common.client.gui.element.Toggle;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.minelittlepony.settings.PonyLevel; import com.minelittlepony.settings.PonyLevel;
import com.minelittlepony.settings.PonyConfig.PonySettings; import com.minelittlepony.settings.PonySettings;
/** /**
* In-Game options menu. * In-Game options menu.
@ -77,7 +77,7 @@ public class GuiPonySettings implements IGuiGuest {
} }
host.addButton(new Label(RIGHT, row += 15)).getStyle().setText(MOB_PREFIX + "title"); host.addButton(new Label(RIGHT, row += 15)).getStyle().setText(MOB_PREFIX + "title");
for (MobRenderers i : MobRenderers.values()) { for (MobRenderers i : MobRenderers.registry) {
host.addButton(new Toggle(RIGHT, row += 20, i.get())) host.addButton(new Toggle(RIGHT, row += 20, i.get()))
.onChange(i) .onChange(i)
.getStyle().setText(MOB_PREFIX + i.name().toLowerCase()); .getStyle().setText(MOB_PREFIX + i.name().toLowerCase());

View file

@ -1,7 +1,7 @@
package com.minelittlepony.client.model; package com.minelittlepony.client.model;
import com.minelittlepony.client.model.armour.ModelPonyArmor; import com.minelittlepony.client.model.armour.ModelPonyArmour;
import com.minelittlepony.client.model.armour.PonyArmor; import com.minelittlepony.client.model.armour.ArmourWrapper;
import com.minelittlepony.client.model.components.PonySnout; import com.minelittlepony.client.model.components.PonySnout;
import com.minelittlepony.client.model.components.PonyTail; import com.minelittlepony.client.model.components.PonyTail;
import com.minelittlepony.client.pony.PonyData; import com.minelittlepony.client.pony.PonyData;
@ -73,7 +73,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
@Override @Override
public IEquestrianArmour<?> createArmour() { public IEquestrianArmour<?> createArmour() {
return new PonyArmor<>(new ModelPonyArmor<>(), new ModelPonyArmor<>()); return new ArmourWrapper<>(new ModelPonyArmour<>(), new ModelPonyArmour<>());
} }
/** /**

View file

@ -6,12 +6,12 @@ import com.minelittlepony.model.armour.ArmourLayer;
import com.minelittlepony.model.armour.IEquestrianArmour; import com.minelittlepony.model.armour.IEquestrianArmour;
import com.minelittlepony.pony.IPonyData; import com.minelittlepony.pony.IPonyData;
public class PonyArmor<T extends LivingEntity> implements IEquestrianArmour<ModelPonyArmor<T>> { public class ArmourWrapper<T extends LivingEntity> implements IEquestrianArmour<ModelPonyArmour<T>> {
private final ModelPonyArmor<T> outerLayer; private final ModelPonyArmour<T> outerLayer;
private final ModelPonyArmor<T> innerLayer; private final ModelPonyArmour<T> innerLayer;
public PonyArmor(ModelPonyArmor<T> outer, ModelPonyArmor<T> inner) { public ArmourWrapper(ModelPonyArmour<T> outer, ModelPonyArmour<T> inner) {
outerLayer = outer; outerLayer = outer;
innerLayer = inner; innerLayer = inner;
} }
@ -29,7 +29,7 @@ public class PonyArmor<T extends LivingEntity> implements IEquestrianArmour<Mode
} }
@Override @Override
public ModelPonyArmor<T> getArmorForLayer(ArmourLayer layer) { public ModelPonyArmour<T> getArmorForLayer(ArmourLayer layer) {
if (layer == ArmourLayer.INNER) { if (layer == ArmourLayer.INNER) {
return innerLayer; return innerLayer;

View file

@ -20,7 +20,7 @@ import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
public class DefaultPonyArmorTextureResolver<T extends LivingEntity> implements IArmourTextureResolver<T> { public class DefaultArmourTextureResolver<T extends LivingEntity> implements IArmourTextureResolver<T> {
private final Map<String, Identifier> HUMAN_ARMOUR = Maps.newHashMap(); private final Map<String, Identifier> HUMAN_ARMOUR = Maps.newHashMap();
private final Map<Identifier, Identifier> PONY_ARMOUR = Maps.newHashMap(); private final Map<Identifier, Identifier> PONY_ARMOUR = Maps.newHashMap();
@ -54,6 +54,7 @@ public class DefaultPonyArmorTextureResolver<T extends LivingEntity> implements
private Identifier resolve(Identifier... resources) { private Identifier resolve(Identifier... resources) {
// check resource packs for either texture. // check resource packs for either texture.
// TODO: We need another way to iterate loaded resourcepacks
for (ClientResourcePackContainer entry : MinecraftClient.getInstance().getResourcePackContainerManager().getEnabledContainers()) { for (ClientResourcePackContainer entry : MinecraftClient.getInstance().getResourcePackContainerManager().getEnabledContainers()) {
ResourcePack pack = entry.createResourcePack(); ResourcePack pack = entry.createResourcePack();
for (Identifier candidate : resources) { for (Identifier candidate : resources) {

View file

@ -8,11 +8,11 @@ import com.minelittlepony.client.util.render.PonyRenderer;
import com.minelittlepony.model.IModel; import com.minelittlepony.model.IModel;
import com.minelittlepony.model.armour.IArmour; import com.minelittlepony.model.armour.IArmour;
public class ModelPonyArmor<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmour { public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmour {
public PonyRenderer chestPiece; public PonyRenderer chestPiece;
public ModelPonyArmor() { public ModelPonyArmour() {
super(false); super(false);
textureHeight = 32; textureHeight = 32;
} }

View file

@ -3,10 +3,10 @@ package com.minelittlepony.client.model.components;
import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.util.render.plane.PlaneRenderer; import com.minelittlepony.client.util.render.plane.PlaneRenderer;
import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.ICapitated;
import com.minelittlepony.pony.meta.Gender; import com.minelittlepony.pony.meta.Gender;
import com.minelittlepony.settings.PonySettings;
import static com.minelittlepony.model.PonyModelConstants.*; import static com.minelittlepony.model.PonyModelConstants.*;
@ -59,7 +59,7 @@ public class PonySnout {
} }
public void setGender(Gender gender) { public void setGender(Gender gender) {
boolean show = !head.hasHeadGear() && !isHidden && MineLittlePony.getInstance().getConfig().snuzzles; boolean show = !head.hasHeadGear() && !isHidden && PonySettings.SNUZZLES.get();
mare.field_3664 = !(show && gender.isMare()); mare.field_3664 = !(show && gender.isMare());
stallion.field_3664 = !(show && gender.isStallion()); stallion.field_3664 = !(show && gender.isStallion());

View file

@ -1,7 +1,7 @@
package com.minelittlepony.client.model.entities; package com.minelittlepony.client.model.entities;
import com.minelittlepony.client.model.armour.ModelPonyArmor; import com.minelittlepony.client.model.armour.ModelPonyArmour;
import com.minelittlepony.client.model.armour.PonyArmor; import com.minelittlepony.client.model.armour.ArmourWrapper;
import com.minelittlepony.client.model.components.SeaponyTail; import com.minelittlepony.client.model.components.SeaponyTail;
import com.minelittlepony.client.model.races.ModelUnicorn; import com.minelittlepony.client.model.races.ModelUnicorn;
import com.minelittlepony.client.util.render.PonyRenderer; import com.minelittlepony.client.util.render.PonyRenderer;
@ -35,7 +35,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
@Override @Override
public IEquestrianArmour<?> createArmour() { public IEquestrianArmour<?> createArmour() {
return new PonyArmor<>(new Armour(), new Armour()); return new ArmourWrapper<>(new Armour(), new Armour());
} }
@Override @Override
@ -187,7 +187,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
rightLegOverlay.visible = false; rightLegOverlay.visible = false;
} }
class Armour extends ModelPonyArmor<T> { class Armour extends ModelPonyArmour<T> {
@Override @Override
public void showBoots() { public void showBoots() {

View file

@ -2,8 +2,8 @@ package com.minelittlepony.client.model.races;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import com.minelittlepony.client.model.armour.ModelPonyArmor; import com.minelittlepony.client.model.armour.ModelPonyArmour;
import com.minelittlepony.client.model.armour.PonyArmor; import com.minelittlepony.client.model.armour.ArmourWrapper;
import com.minelittlepony.client.util.render.PonyRenderer; import com.minelittlepony.client.util.render.PonyRenderer;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.armour.IEquestrianArmour; import com.minelittlepony.model.armour.IEquestrianArmour;
@ -19,7 +19,7 @@ public class ModelZebra<T extends LivingEntity> extends ModelEarthPony<T> {
@Override @Override
public IEquestrianArmour<?> createArmour() { public IEquestrianArmour<?> createArmour() {
return new PonyArmor<>(new Armour(), new Armour()); return new ArmourWrapper<>(new Armour(), new Armour());
} }
@Override @Override
@ -51,7 +51,7 @@ public class ModelZebra<T extends LivingEntity> extends ModelEarthPony<T> {
.pitch = -1F; .pitch = -1F;
} }
class Armour extends ModelPonyArmor<T> { class Armour extends ModelPonyArmour<T> {
@Override @Override
public void transform(BodyPart part) { public void transform(BodyPart part) {

View file

@ -7,6 +7,7 @@ import com.minelittlepony.client.ducks.IRenderItem;
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer; import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
import com.minelittlepony.client.util.render.Color; import com.minelittlepony.client.util.render.Color;
import com.minelittlepony.pony.IPony; import com.minelittlepony.pony.IPony;
import com.minelittlepony.settings.PonySettings;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.AbstractClientPlayerEntity;
@ -71,7 +72,7 @@ public class LevitatingItemRenderer {
pushMatrix(); pushMatrix();
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic && pony.getMetadata().hasMagic(); boolean doMagic = PonySettings.FPSMAGIC.get() && pony.getMetadata().hasMagic();
if (doMagic) { if (doMagic) {
setupPerspective(renderer, entity, stack, left); setupPerspective(renderer, entity, stack, left);

View file

@ -1,11 +1,11 @@
package com.minelittlepony.client.render; package com.minelittlepony.client.render;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.PonyRenderManager; import com.minelittlepony.client.PonyRenderManager;
import com.minelittlepony.client.model.ModelWrapper; import com.minelittlepony.client.model.ModelWrapper;
import com.minelittlepony.client.transform.PonyPosture; import com.minelittlepony.client.transform.PonyPosture;
import com.minelittlepony.model.IPonyModel; import com.minelittlepony.model.IPonyModel;
import com.minelittlepony.pony.IPony; import com.minelittlepony.pony.IPony;
import com.minelittlepony.settings.PonySettings;
import com.minelittlepony.util.math.MathUtil; import com.minelittlepony.util.math.MathUtil;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
@ -43,7 +43,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
} }
public VisibleRegion getFrustrum(T entity, VisibleRegion vanilla) { public VisibleRegion getFrustrum(T entity, VisibleRegion vanilla) {
if (entity.isSleeping() || !MineLittlePony.getInstance().getConfig().frustrum) { if (entity.isSleeping() || !PonySettings.FRUSTRUM.get()) {
return vanilla; return vanilla;
} }
return frustrum.withCamera(entity, vanilla); return frustrum.withCamera(entity, vanilla);

View file

@ -3,7 +3,8 @@ package com.minelittlepony.client.render.entities;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.PonyRenderManager; import com.minelittlepony.client.PonyRenderManager;
import com.minelittlepony.common.SensibleConfig.Setting; import com.minelittlepony.settings.SensibleConfig;
import com.minelittlepony.settings.SensibleConfig.Setting;
import java.util.List; import java.util.List;
@ -77,6 +78,11 @@ public enum MobRenderers implements Setting {
apply(PonyRenderManager.getInstance()); apply(PonyRenderManager.getInstance());
} }
@Override
public SensibleConfig config() {
return MineLittlePony.getInstance().getConfig();
}
public void apply(PonyRenderManager pony) { public void apply(PonyRenderManager pony) {
boolean state = get(); boolean state = get();
register(state, pony); register(state, pony);

View file

@ -2,7 +2,7 @@ package com.minelittlepony.client.render.layer;
import com.minelittlepony.client.ForgeProxy; import com.minelittlepony.client.ForgeProxy;
import com.minelittlepony.client.model.ModelWrapper; import com.minelittlepony.client.model.ModelWrapper;
import com.minelittlepony.client.model.armour.DefaultPonyArmorTextureResolver; import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
import com.minelittlepony.client.render.IPonyRender; import com.minelittlepony.client.render.IPonyRender;
import com.minelittlepony.client.util.render.Color; import com.minelittlepony.client.util.render.Color;
import com.minelittlepony.model.IPonyModel; import com.minelittlepony.model.IPonyModel;
@ -25,7 +25,7 @@ import net.minecraft.util.Identifier;
public class LayerPonyArmor<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> { public class LayerPonyArmor<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> {
private static final IArmourTextureResolver<LivingEntity> textures = new DefaultPonyArmorTextureResolver<>(); private static final IArmourTextureResolver<LivingEntity> textures = new DefaultArmourTextureResolver<>();
private ModelWrapper<T, M> pony; private ModelWrapper<T, M> pony;

View file

@ -1,48 +1,44 @@
package com.minelittlepony.client.render.tileentities.skull; package com.minelittlepony.client.render.tileentities.skull;
import com.google.common.collect.Maps;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.MineLPClient; import com.minelittlepony.client.MineLPClient;
import com.minelittlepony.client.ducks.IRenderItem; import com.minelittlepony.client.ducks.IRenderItem;
import com.minelittlepony.pony.IPony; import com.minelittlepony.pony.IPony;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.minelittlepony.settings.PonySettings;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.block.SkullBlock; import net.minecraft.block.SkullBlock;
import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.SystemUtil;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import static com.mojang.blaze3d.platform.GlStateManager.*;
/** /**
* PonySkullRenderer! It renders ponies as skulls, or something... * PonySkullRenderer! It renders ponies as skulls, or something...
*/ */
public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRenderItem { public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRenderItem {
public static final int SKELETON = 0;
public static final int WITHER = 1;
public static final int ZOMBIE = 2;
public static final int PLAYER = 3;
public static final int CREEPER = 4;
public static final int DRAGON = 5;
public static PonySkullRenderer ponyInstance = new PonySkullRenderer(); public static PonySkullRenderer ponyInstance = new PonySkullRenderer();
private static SkullBlockEntityRenderer backup = null; private static SkullBlockEntityRenderer backup = null;
private final Map<SkullBlock.SkullType, ISkull> skullMap = new HashMap<>(); private boolean transparency = false;
private PonySkullRenderer() { private static final Map<SkullBlock.SkullType, ISkull> skullMap = SystemUtil.consume(Maps.newHashMap(), (skullMap) -> {
skullMap.put(SkullBlock.Type.SKELETON, new SkeletonSkullRenderer()); skullMap.put(SkullBlock.Type.SKELETON, new SkeletonSkullRenderer());
skullMap.put(SkullBlock.Type.WITHER_SKELETON, new WitherSkullRenderer()); skullMap.put(SkullBlock.Type.WITHER_SKELETON, new WitherSkullRenderer());
skullMap.put(SkullBlock.Type.ZOMBIE, new ZombieSkullRenderer()); skullMap.put(SkullBlock.Type.ZOMBIE, new ZombieSkullRenderer());
skullMap.put(SkullBlock.Type.PLAYER, new PlayerSkullRenderer()); skullMap.put(SkullBlock.Type.PLAYER, new PlayerSkullRenderer());
} });
/** /**
* Resolves the games skull renderer to either a specialised pony skull renderer * Resolves the games skull renderer to either a specialised pony skull renderer
@ -51,7 +47,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRend
* Original/Existing renderer is stored to a backup variable as a fallback in case of mods. * Original/Existing renderer is stored to a backup variable as a fallback in case of mods.
*/ */
public static SkullBlockEntityRenderer resolve() { public static SkullBlockEntityRenderer resolve() {
if (MineLittlePony.getInstance().getConfig().ponyskulls) { if (PonySettings.PONYSKULLS.get()) {
if (!(INSTANCE instanceof PonySkullRenderer)) { if (!(INSTANCE instanceof PonySkullRenderer)) {
backup = INSTANCE; backup = INSTANCE;
MineLPClient.getInstance().getModUtilities().addRenderer(SkullBlockEntity.class, ponyInstance); MineLPClient.getInstance().getModUtilities().addRenderer(SkullBlockEntity.class, ponyInstance);
@ -71,8 +67,6 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRend
return INSTANCE; return INSTANCE;
} }
protected boolean transparency = false;
@Override @Override
public void render(float x, float y, float z, @Nullable Direction facing, float rotation, SkullBlock.SkullType skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) { public void render(float x, float y, float z, @Nullable Direction facing, float rotation, SkullBlock.SkullType skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) {
@ -92,11 +86,11 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRend
if (destroyStage >= 0) { if (destroyStage >= 0) {
bindTexture(DESTROY_STAGE_TEXTURES[destroyStage]); bindTexture(DESTROY_STAGE_TEXTURES[destroyStage]);
GlStateManager.matrixMode(GL11.GL_TEXTURE); matrixMode(GL11.GL_TEXTURE);
GlStateManager.pushMatrix(); pushMatrix();
GlStateManager.scalef(4, 2, 1); scalef(4, 2, 1);
GlStateManager.translatef(scale, scale, scale); translatef(scale, scale, scale);
GlStateManager.matrixMode(GL11.GL_MODELVIEW); matrixMode(GL11.GL_MODELVIEW);
} else { } else {
Identifier skin = skull.getSkinResource(profile); Identifier skin = skull.getSkinResource(profile);
@ -105,24 +99,24 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRend
bindTexture(skin); bindTexture(skin);
} }
GlStateManager.pushMatrix(); pushMatrix();
GlStateManager.disableCull(); disableCull();
rotation = handleRotation(x, y, z, facing, rotation); rotation = handleRotation(x, y, z, facing, rotation);
GlStateManager.enableRescaleNormal(); enableRescaleNormal();
GlStateManager.scalef(-1, -1, 1); scalef(-1, -1, 1);
GlStateManager.enableAlphaTest(); enableAlphaTest();
skull.preRender(transparency); skull.preRender(usesTransparency());
skull.render(animateTicks, rotation, scale); skull.render(animateTicks, rotation, scale);
GlStateManager.popMatrix(); popMatrix();
if (destroyStage >= 0) { if (destroyStage >= 0) {
GlStateManager.matrixMode(GL11.GL_TEXTURE); matrixMode(GL11.GL_TEXTURE);
GlStateManager.popMatrix(); popMatrix();
GlStateManager.matrixMode(GL11.GL_MODELVIEW); matrixMode(GL11.GL_MODELVIEW);
} }
} }
@ -130,19 +124,19 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer implements IRend
switch (facing) { switch (facing) {
case EAST: case EAST:
default: default:
GlStateManager.translatef(x + 0.26F, y + 0.25F, z + 0.5F); translatef(x + 0.26F, y + 0.25F, z + 0.5F);
return 90; return 90;
case UP: case UP:
GlStateManager.translatef(x + 0.5F, y, z + 0.5F); translatef(x + 0.5F, y, z + 0.5F);
break; break;
case NORTH: case NORTH:
GlStateManager.translatef(x + 0.5F, y + 0.25F, z + 0.74F); translatef(x + 0.5F, y + 0.25F, z + 0.74F);
break; break;
case SOUTH: case SOUTH:
GlStateManager.translatef(x + 0.5F, y + 0.25F, z + 0.26F); translatef(x + 0.5F, y + 0.25F, z + 0.26F);
return 180; return 180;
case WEST: case WEST:
GlStateManager.translatef(x + 0.74F, y + 0.25F, z + 0.5F); translatef(x + 0.74F, y + 0.25F, z + 0.5F);
return 270; return 270;
} }

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.tileentities.skull; package com.minelittlepony.client.render.tileentities.skull;
import com.minelittlepony.client.render.entities.MobRenderers;
import com.minelittlepony.client.render.entities.RenderPonySkeleton; import com.minelittlepony.client.render.entities.RenderPonySkeleton;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -11,7 +12,7 @@ public class SkeletonSkullRenderer extends PonySkull {
@Override @Override
public boolean canRender(PonyConfig config) { public boolean canRender(PonyConfig config) {
return config.skeletons; return MobRenderers.SKELETONS.get();
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.tileentities.skull; package com.minelittlepony.client.render.tileentities.skull;
import com.minelittlepony.client.render.entities.MobRenderers;
import com.minelittlepony.client.render.entities.RenderPonySkeleton; import com.minelittlepony.client.render.entities.RenderPonySkeleton;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -11,7 +12,7 @@ public class WitherSkullRenderer extends PonySkull {
@Override @Override
public boolean canRender(PonyConfig config) { public boolean canRender(PonyConfig config) {
return config.skeletons; return MobRenderers.SKELETONS.get();
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.tileentities.skull; package com.minelittlepony.client.render.tileentities.skull;
import com.minelittlepony.client.render.entities.MobRenderers;
import com.minelittlepony.client.render.entities.RenderPonyZombie; import com.minelittlepony.client.render.entities.RenderPonyZombie;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -11,7 +12,7 @@ public class ZombieSkullRenderer extends PonySkull {
@Override @Override
public boolean canRender(PonyConfig config) { public boolean canRender(PonyConfig config) {
return config.zombies; return MobRenderers.ZOMBIES.get();
} }
@Override @Override

View file

@ -9,7 +9,7 @@ public class HornGlow extends Box<GlowRenderer> {
private final float alpha; private final float alpha;
private Quad[] quadList; private Quad[] polygons;
public HornGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, float alpha) { public HornGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, float alpha) {
super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale); super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale);
@ -47,7 +47,7 @@ public class HornGlow extends Box<GlowRenderer> {
Vertex eun = vert(xMax, yMax, zMax, 8, 8); Vertex eun = vert(xMax, yMax, zMax, 8, 8);
Vertex wun = vert(xMin, yMax, zMax, 8, 0); Vertex wun = vert(xMin, yMax, zMax, 8, 0);
quadList = new Quad[] { polygons = new Quad[] {
quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun), quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun),
quad(texX, d, texY + d, h, wds, wdn, wun, wus), quad(texX, d, texY + d, h, wds, wdn, wun, wus),
quad(texX + d, w, texY, d, edn, wdn, wds, eds), quad(texX + d, w, texY, d, edn, wdn, wds, eds),
@ -57,7 +57,7 @@ public class HornGlow extends Box<GlowRenderer> {
}; };
if (renderer.mirror) { if (renderer.mirror) {
for (Quad i : quadList) { for (Quad i : polygons) {
i.flip(); i.flip();
} }
} }
@ -67,7 +67,7 @@ public class HornGlow extends Box<GlowRenderer> {
public void render(BufferBuilder buffer, float scale) { public void render(BufferBuilder buffer, float scale) {
parent.applyTint(alpha); parent.applyTint(alpha);
for (Quad i : quadList) { for (Quad i : polygons) {
i.render(buffer, scale); i.render(buffer, scale);
} }
} }

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client.util.render.plane; package com.minelittlepony.client.util.render.plane;
import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferBuilder;
import net.minecraft.util.math.Direction;
import com.minelittlepony.client.util.render.Box; import com.minelittlepony.client.util.render.Box;
import com.minelittlepony.client.util.render.Quad; import com.minelittlepony.client.util.render.Quad;
@ -14,7 +15,7 @@ public class ModelPlane extends Box<PlaneRenderer> {
public boolean hidden = false; public boolean hidden = false;
public ModelPlane(PlaneRenderer renderer, int textureX, int textureY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, Plane face) { public ModelPlane(PlaneRenderer renderer, int textureX, int textureY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, Direction face) {
super(renderer, textureX, textureY, xMin, yMin, zMin, w, h, d, scale, false); super(renderer, textureX, textureY, xMin, yMin, zMin, w, h, d, scale, false);
float xMax = xMin + w + scale; float xMax = xMin + w + scale;
@ -53,22 +54,22 @@ public class ModelPlane extends Box<PlaneRenderer> {
Vertex eun = vert(xMax, yMax, zMax, 8, 8); Vertex eun = vert(xMax, yMax, zMax, 8, 8);
Vertex wun = vert(xMin, yMax, zMax, 8, 0); Vertex wun = vert(xMin, yMax, zMax, 8, 0);
if (face == Plane.EAST) { if (face == Direction.EAST) {
quad = quad(textureX, d, textureY, h, edn, eds, eus, eun); quad = quad(textureX, d, textureY, h, edn, eds, eus, eun);
} }
if (face == Plane.WEST) { if (face == Direction.WEST) {
quad = quad(textureX, d, textureY, h, wds, wdn, wun, wus); quad = quad(textureX, d, textureY, h, wds, wdn, wun, wus);
} }
if (face == Plane.UP) { if (face == Direction.UP) {
quad = quad(textureX, w, textureY, d, edn, wdn, wds, eds); quad = quad(textureX, w, textureY, d, edn, wdn, wds, eds);
} }
if (face == Plane.DOWN) { if (face == Direction.DOWN) {
quad = quad(textureX, w, textureY, d, eus, wus, wun, eun); quad = quad(textureX, w, textureY, d, eus, wus, wun, eun);
} }
if (face == Plane.SOUTH) { if (face == Direction.SOUTH) {
quad = quad(textureX, w, textureY, h, eds, wds, wus, eus); quad = quad(textureX, w, textureY, h, eds, wds, wus, eus);
} }
if (face == Plane.NORTH) { if (face == Direction.NORTH) {
quad = quad(textureX, w, textureY, h, wdn, edn, eun, wun); quad = quad(textureX, w, textureY, h, wdn, edn, eun, wun);
} }

View file

@ -1,10 +0,0 @@
package com.minelittlepony.client.util.render.plane;
enum Plane {
NORTH,
SOUTH,
UP,
DOWN,
EAST,
WEST
}

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client.util.render.plane; package com.minelittlepony.client.util.render.plane;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import net.minecraft.util.math.Direction;
import com.minelittlepony.client.util.render.AbstractRenderer; import com.minelittlepony.client.util.render.AbstractRenderer;
@ -37,32 +38,32 @@ public class PlaneRenderer extends AbstractRenderer<PlaneRenderer> {
return new PlaneRenderer(baseModel, textureOffsetX, textureOffsetY); return new PlaneRenderer(baseModel, textureOffsetX, textureOffsetY);
} }
private PlaneRenderer addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Plane face) { private PlaneRenderer addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Direction face) {
boxes.add(new ModelPlane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face)); boxes.add(new ModelPlane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face));
return this; return this;
} }
public PlaneRenderer top(float offX, float offY, float offZ, int width, int depth, float scale) { public PlaneRenderer top(float offX, float offY, float offZ, int width, int depth, float scale) {
return addPlane(offX, offY, offZ, width, 0, depth, scale, Plane.UP); return addPlane(offX, offY, offZ, width, 0, depth, scale, Direction.UP);
} }
public PlaneRenderer bottom(float offX, float offY, float offZ, int width, int depth, float scale) { public PlaneRenderer bottom(float offX, float offY, float offZ, int width, int depth, float scale) {
return addPlane(offX, offY, offZ, width, 0, depth, scale, Plane.DOWN); return addPlane(offX, offY, offZ, width, 0, depth, scale, Direction.DOWN);
} }
public PlaneRenderer west(float offX, float offY, float offZ, int height, int depth, float scale) { public PlaneRenderer west(float offX, float offY, float offZ, int height, int depth, float scale) {
return addPlane(offX, offY, offZ, 0, height, depth, scale, Plane.WEST); return addPlane(offX, offY, offZ, 0, height, depth, scale, Direction.WEST);
} }
public PlaneRenderer east(float offX, float offY, float offZ, int height, int depth, float scale) { public PlaneRenderer east(float offX, float offY, float offZ, int height, int depth, float scale) {
return addPlane(offX, offY, offZ, 0, height, depth, scale, Plane.EAST); return addPlane(offX, offY, offZ, 0, height, depth, scale, Direction.EAST);
} }
public PlaneRenderer north(float offX, float offY, float offZ, int width, int height, float scale) { public PlaneRenderer north(float offX, float offY, float offZ, int width, int height, float scale) {
return addPlane(offX, offY, offZ - scale * 2, width, height, 0, scale, Plane.NORTH); return addPlane(offX, offY, offZ - scale * 2, width, height, 0, scale, Direction.NORTH);
} }
public PlaneRenderer south(float offX, float offY, float offZ, int width, int height, float scale) { public PlaneRenderer south(float offX, float offY, float offZ, int width, int height, float scale) {
return addPlane(offX, offY, offZ + scale * 2, width, height, 0, scale, Plane.SOUTH); return addPlane(offX, offY, offZ + scale * 2, width, height, 0, scale, Direction.SOUTH);
} }
} }

View file

@ -2,6 +2,7 @@ package com.minelittlepony.pony.meta;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.pony.ITriggerPixelMapped; import com.minelittlepony.pony.ITriggerPixelMapped;
import com.minelittlepony.settings.PonySettings;
public enum Size implements ITriggerPixelMapped<Size> { public enum Size implements ITriggerPixelMapped<Size> {
TALL(0x534b76, 0.45f, 1.1F), TALL(0x534b76, 0.45f, 1.1F),
@ -36,6 +37,6 @@ public enum Size implements ITriggerPixelMapped<Size> {
} }
public Size getEffectiveSize() { public Size getEffectiveSize() {
return MineLittlePony.getInstance().getConfig().sizes ? this : Size.NORMAL; return PonySettings.SIZES.get() ? this : Size.NORMAL;
} }
} }

View file

@ -0,0 +1,5 @@
package com.minelittlepony.settings;
public enum MobSettings {
}

View file

@ -11,31 +11,21 @@ public abstract class PonyConfig extends SensibleJsonConfig {
@Expose private PonyLevel ponylevel = PonyLevel.PONIES; @Expose private PonyLevel ponylevel = PonyLevel.PONIES;
@Expose public boolean sizes = true; @Expose boolean sizes = true;
@Expose public boolean snuzzles = true; @Expose boolean snuzzles = true;
@Expose public boolean hd = true; @Expose boolean hd = true;
@Expose public boolean showscale = true; @Expose boolean showscale = true;
@Expose public boolean fpsmagic = true; @Expose boolean fpsmagic = true;
@Expose public boolean ponyskulls = true; @Expose boolean ponyskulls = true;
@Expose public boolean frustrum = true; @Expose boolean frustrum = true;
public enum PonySettings implements Setting { @Expose boolean villagers = true;
SIZES, @Expose boolean zombies = true;
SNUZZLES, @Expose boolean pigzombies = true;
HD, @Expose boolean skeletons = true;
SHOWSCALE, @Expose boolean illagers = true;
FPSMAGIC, @Expose boolean guardians = true;
PONYSKULLS, @Expose boolean endermen = true;
FRUSTRUM;
}
@Expose public boolean villagers = true;
@Expose public boolean zombies = true;
@Expose public boolean pigzombies = true;
@Expose public boolean skeletons = true;
@Expose public boolean illagers = true;
@Expose public boolean guardians = true;
@Expose public boolean endermen = true;
@Expose private float globalScaleFactor = 0.9F; @Expose private float globalScaleFactor = 0.9F;

View file

@ -0,0 +1,19 @@
package com.minelittlepony.settings;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.settings.SensibleConfig.Setting;
public enum PonySettings implements Setting {
SIZES,
SNUZZLES,
HD,
SHOWSCALE,
FPSMAGIC,
PONYSKULLS,
FRUSTRUM;
@Override
public SensibleConfig config() {
return MineLittlePony.getInstance().getConfig();
}
}

View file

@ -11,12 +11,6 @@ import com.minelittlepony.common.client.gui.IField.IChangeCallback;
// Mumfrey pls. // Mumfrey pls.
public abstract class SensibleConfig { public abstract class SensibleConfig {
private static SensibleConfig instance;
public SensibleConfig() {
instance = this;
}
public abstract void save(); public abstract void save();
public interface Setting extends IChangeCallback<Boolean> { public interface Setting extends IChangeCallback<Boolean> {
@ -26,16 +20,18 @@ public abstract class SensibleConfig {
* Gets the config value associated with this entry. * Gets the config value associated with this entry.
*/ */
default boolean get() { default boolean get() {
return instance.getValue(this); return config().getValue(this);
} }
/** /**
* Sets the config value associated with this entry. * Sets the config value associated with this entry.
*/ */
default void set(boolean value) { default void set(boolean value) {
instance.setValue(this, value); config().setValue(this, value);
} }
SensibleConfig config();
@Override @Override
default Boolean perform(Boolean v) { default Boolean perform(Boolean v) {
set(v); set(v);

View file

@ -4,7 +4,6 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
import com.minelittlepony.client.settings.ClientPonyConfig; import com.minelittlepony.client.settings.ClientPonyConfig;
import com.minelittlepony.common.SensibleConfig;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;