Revert "Fix spelling mistake and apply custom panoramas to the title screen"

This reverts commit a5b0e187a0.
This commit is contained in:
Matthew Messinger 2018-07-05 22:49:28 -04:00
parent b7d17d594c
commit a92a121a5b
12 changed files with 19 additions and 93 deletions

View file

@ -60,11 +60,14 @@ public class CubeMap {
} }
public void setSource(String source) { public void setSource(String source) {
setSource(CubeMapRegistry.generatePanoramaResources(source)); cubemapTextures = new ResourceLocation[] {
} new ResourceLocation(String.format(source, 0)),
new ResourceLocation(String.format(source, 1)),
public void setSource(ResourceLocation[] source) { new ResourceLocation(String.format(source, 2)),
cubemapTextures = source; new ResourceLocation(String.format(source, 3)),
new ResourceLocation(String.format(source, 4)),
new ResourceLocation(String.format(source, 5))
};
} }
public void init() { public void init() {
@ -239,4 +242,5 @@ public class CubeMap {
vb.pos(0, 0, zLevel).tex(0.5F + uSample, 0.5F + vSample).endVertex(); vb.pos(0, 0, zLevel).tex(0.5F + uSample, 0.5F + vSample).endVertex();
tessellator.draw(); tessellator.draw();
} }
} }

View file

@ -1,51 +0,0 @@
package com.voxelmodpack.hdskins.gui;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.ResourceLocation;
public final class CubeMapRegistry {
private static final List<String> RAW_SOURCES = new ArrayList<String>();
private static final List<ResourceLocation[]> SOURCES = new ArrayList<>();
public static ResourceLocation[] generatePanoramaResources(String source) {
return new ResourceLocation[] {
new ResourceLocation(String.format(source, 0)),
new ResourceLocation(String.format(source, 1)),
new ResourceLocation(String.format(source, 2)),
new ResourceLocation(String.format(source, 3)),
new ResourceLocation(String.format(source, 4)),
new ResourceLocation(String.format(source, 5))
};
}
public static void addSource(String source) {
if (!RAW_SOURCES.contains(source)) {
SOURCES.add(generatePanoramaResources(source));
}
}
public static int getRandomResourceIndex(boolean includeVanilla) {
int count = SOURCES.size();
if (includeVanilla) count++;
count = (int)Math.floor(Math.random() * count);
if (count >= SOURCES.size()) {
return -1;
}
return count;
}
public static ResourceLocation[] pickResource() {
return getResource(getRandomResourceIndex(false));
}
public static ResourceLocation[] getResource(int index) {
return SOURCES.get(index % SOURCES.size());
}
}

View file

@ -1,39 +1,22 @@
package com.voxelmodpack.hdskins.mixin; package com.voxelmodpack.hdskins.mixin;
import com.voxelmodpack.hdskins.HDSkinManager; import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
import com.voxelmodpack.hdskins.gui.GuiItemStackButton; import com.voxelmodpack.hdskins.gui.GuiItemStackButton;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GuiMainMenu.class) @Mixin(GuiMainMenu.class)
public class MixinGuiMainMenu extends GuiScreen { public class MixinGuiMainMenu extends GuiScreen {
@Shadow @Final
private static ResourceLocation[] TITLE_PANORAMA_PATHS;
private int cubemapRandomResourceIndex = -2;
private static final int SKINS = 5000; private static final int SKINS = 5000;
@Inject(method = "<init>()V", at = @At("RETURN"))
private void init(CallbackInfo info) {
cubemapRandomResourceIndex = CubeMapRegistry.getRandomResourceIndex(true);
}
@Inject(method = "initGui()V", at = @At("RETURN")) @Inject(method = "initGui()V", at = @At("RETURN"))
private void onInit(CallbackInfo ci) { private void onInit(CallbackInfo ci) {
ItemStack itemStack = new ItemStack(Items.LEATHER_LEGGINGS); ItemStack itemStack = new ItemStack(Items.LEATHER_LEGGINGS);
@ -47,10 +30,4 @@ public class MixinGuiMainMenu extends GuiScreen {
this.mc.displayGuiScreen(HDSkinManager.INSTANCE.createSkinsGui()); this.mc.displayGuiScreen(HDSkinManager.INSTANCE.createSkinsGui());
} }
} }
@Redirect(method = "drawPanorama(IIF)V",
at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiMainMenu;TITLE_PANORAMA_PATHS:[Lnet/minecraft/util/ResourceLocation;"))
private ResourceLocation[] getPanoramaArray() {
return cubemapRandomResourceIndex < 0 ? TITLE_PANORAMA_PATHS : CubeMapRegistry.getResource(cubemapRandomResourceIndex);
}
} }

View file

@ -7,7 +7,6 @@ import com.minelittlepony.pony.data.PonyDataSerialzier;
import com.minelittlepony.render.PonySkullRenderer; import com.minelittlepony.render.PonySkullRenderer;
import com.mumfrey.liteloader.core.LiteLoader; import com.mumfrey.liteloader.core.LiteLoader;
import com.voxelmodpack.hdskins.HDSkinManager; import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
import com.voxelmodpack.hdskins.skins.SkinServer; import com.voxelmodpack.hdskins.skins.SkinServer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
@ -50,7 +49,6 @@ public class MineLittlePony {
renderManager = new PonyRenderManager(); renderManager = new PonyRenderManager();
LiteLoader.getInstance().registerExposable(config, null); LiteLoader.getInstance().registerExposable(config, null);
LiteLoader.getInstance().writeConfig(config);
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
irrm.registerReloadListener(ponyManager); irrm.registerReloadListener(ponyManager);
@ -60,10 +58,6 @@ public class MineLittlePony {
// This also makes it the default gateway server. // This also makes it the default gateway server.
SkinServer.defaultServers.add(MINELP_LEGACY_SERVER); SkinServer.defaultServers.add(MINELP_LEGACY_SERVER);
for (String resource : config.panoramas) {
CubeMapRegistry.addSource(resource);
}
} }
/** /**

View file

@ -39,11 +39,6 @@ public class PonyConfig extends SensibleConfig implements Exposable {
@Expose public boolean illagers = true; @Expose public boolean illagers = true;
@Expose public boolean guardians = true; @Expose public boolean guardians = true;
@Expose public String[] panoramas = new String[] {
"minelp:textures/cubemap/sugarcubecorner_%d.png",
"minelp:textures/cubemap/quillsandsofas_%d.png"
};
/** /**
* Gets the current PonyLevel. That is the level of ponies you would like to see. * Gets the current PonyLevel. That is the level of ponies you would like to see.
* @param ignorePony true to ignore whatever value the setting has. * @param ignorePony true to ignore whatever value the setting has.

View file

@ -5,7 +5,6 @@ import com.minelittlepony.PonyManager;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
import com.voxelmodpack.hdskins.gui.EntityPlayerModel; import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
import com.voxelmodpack.hdskins.gui.GuiItemStackButton; import com.voxelmodpack.hdskins.gui.GuiItemStackButton;
import com.voxelmodpack.hdskins.gui.GuiSkins; import com.voxelmodpack.hdskins.gui.GuiSkins;
@ -28,6 +27,12 @@ public class GuiSkinsMineLP extends GuiSkins {
private boolean isWet = false; private boolean isWet = false;
private static final String[] panoramas = new String[] {
"minelp:textures/cubemap/sugurcubecorner_%d.png",
"minelp:textures/cubemap/quillsandsofas_%d.png"
};
@Override @Override
protected EntityPlayerModel getModel(GameProfile profile) { protected EntityPlayerModel getModel(GameProfile profile) {
return new EntityPonyModel(profile); return new EntityPonyModel(profile);
@ -46,7 +51,9 @@ public class GuiSkinsMineLP extends GuiSkins {
@Override @Override
protected void initPanorama() { protected void initPanorama() {
panorama.setSource(CubeMapRegistry.pickResource()); int i = (int)Math.floor(Math.random() * panoramas.length);
panorama.setSource(panoramas[i]);
} }
@ -96,7 +103,7 @@ public class GuiSkinsMineLP extends GuiSkins {
@Override @Override
protected void onSetRemoteSkin(Type type, ResourceLocation resource, MinecraftProfileTexture profileTexture) { protected void onSetRemoteSkin(Type type, ResourceLocation resource, MinecraftProfileTexture profileTexture) {
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin"); MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
if (ponyManager != null && resource != null && type == Type.SKIN) { if (type == Type.SKIN) {
ponyManager.removePony(resource); ponyManager.removePony(resource);
} }
} }