Fix spelling mistake and apply custom panoramas to the title screen
|
@ -60,14 +60,11 @@ public class CubeMap {
|
|||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
cubemapTextures = 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))
|
||||
};
|
||||
setSource(CubeMapRegistry.generatePanoramaResources(source));
|
||||
}
|
||||
|
||||
public void setSource(ResourceLocation[] source) {
|
||||
cubemapTextures = source;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
@ -242,5 +239,4 @@ public class CubeMap {
|
|||
vb.pos(0, 0, zLevel).tex(0.5F + uSample, 0.5F + vSample).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
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());
|
||||
}
|
||||
}
|
|
@ -1,22 +1,39 @@
|
|||
package com.voxelmodpack.hdskins.mixin;
|
||||
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
|
||||
import com.voxelmodpack.hdskins.gui.GuiItemStackButton;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.init.Items;
|
||||
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.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiMainMenu.class)
|
||||
public class MixinGuiMainMenu extends GuiScreen {
|
||||
|
||||
@Shadow @Final
|
||||
private static ResourceLocation[] TITLE_PANORAMA_PATHS;
|
||||
|
||||
private int cubemapRandomResourceIndex = -2;
|
||||
|
||||
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"))
|
||||
private void onInit(CallbackInfo ci) {
|
||||
ItemStack itemStack = new ItemStack(Items.LEATHER_LEGGINGS);
|
||||
|
@ -30,4 +47,10 @@ public class MixinGuiMainMenu extends GuiScreen {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.pony.data.PonyDataSerialzier;
|
|||
import com.minelittlepony.render.PonySkullRenderer;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
|
||||
import com.voxelmodpack.hdskins.skins.SkinServer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
@ -49,6 +50,7 @@ public class MineLittlePony {
|
|||
renderManager = new PonyRenderManager();
|
||||
|
||||
LiteLoader.getInstance().registerExposable(config, null);
|
||||
LiteLoader.getInstance().writeConfig(config);
|
||||
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
irrm.registerReloadListener(ponyManager);
|
||||
|
@ -58,6 +60,10 @@ public class MineLittlePony {
|
|||
|
||||
// This also makes it the default gateway server.
|
||||
SkinServer.defaultServers.add(MINELP_LEGACY_SERVER);
|
||||
|
||||
for (String resource : config.panoramas) {
|
||||
CubeMapRegistry.addSource(resource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,6 +39,11 @@ public class PonyConfig extends SensibleConfig implements Exposable {
|
|||
@Expose public boolean illagers = 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.
|
||||
* @param ignorePony true to ignore whatever value the setting has.
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.PonyManager;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
|
||||
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
||||
import com.voxelmodpack.hdskins.gui.GuiItemStackButton;
|
||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||
|
@ -27,12 +28,6 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
|
||||
private boolean isWet = false;
|
||||
|
||||
|
||||
private static final String[] panoramas = new String[] {
|
||||
"minelp:textures/cubemap/sugurcubecorner_%d.png",
|
||||
"minelp:textures/cubemap/quillsandsofas_%d.png"
|
||||
};
|
||||
|
||||
@Override
|
||||
protected EntityPlayerModel getModel(GameProfile profile) {
|
||||
return new EntityPonyModel(profile);
|
||||
|
@ -51,9 +46,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
|
||||
@Override
|
||||
protected void initPanorama() {
|
||||
int i = (int)Math.floor(Math.random() * panoramas.length);
|
||||
|
||||
panorama.setSource(panoramas[i]);
|
||||
panorama.setSource(CubeMapRegistry.pickResource());
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +96,7 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
@Override
|
||||
protected void onSetRemoteSkin(Type type, ResourceLocation resource, MinecraftProfileTexture profileTexture) {
|
||||
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
||||
if (type == Type.SKIN) {
|
||||
if (ponyManager != null && resource != null && type == Type.SKIN) {
|
||||
ponyManager.removePony(resource);
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 180 KiB |
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 248 KiB |
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |