mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-04-01 01:05:27 +02:00
1.13 port part 2
This commit is contained in:
parent
fa649398eb
commit
003a6547bf
6 changed files with 57 additions and 57 deletions
|
@ -4,7 +4,6 @@ import net.minecraft.client.renderer.entity.Render;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Timer;
|
|
||||||
|
|
||||||
public interface IModUtilities {
|
public interface IModUtilities {
|
||||||
<T extends TileEntity> void addRenderer(Class<T> type, TileEntityRenderer<T> renderer);
|
<T extends TileEntity> void addRenderer(Class<T> type, TileEntityRenderer<T> renderer);
|
||||||
|
@ -13,5 +12,5 @@ public interface IModUtilities {
|
||||||
|
|
||||||
boolean hasFml();
|
boolean hasFml();
|
||||||
|
|
||||||
Timer getGameTimer();
|
float getRenderPartialTicks();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.hdskins.gui;
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.util.glu.Project;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
@ -16,6 +15,10 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Replace with RenderSkybox
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class CubeMap {
|
public class CubeMap {
|
||||||
|
|
||||||
private int updateCounter = 0;
|
private int updateCounter = 0;
|
||||||
|
@ -52,7 +55,7 @@ public class CubeMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
viewportTexture = mc.getTextureManager().getDynamicTextureLocation("skinpanorama", new DynamicTexture(256, 256));
|
viewportTexture = mc.getTextureManager().getDynamicTextureLocation("skinpanorama", new DynamicTexture(256, 256, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
|
@ -74,7 +77,8 @@ public class CubeMap {
|
||||||
matrixMode(GL11.GL_PROJECTION);
|
matrixMode(GL11.GL_PROJECTION);
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
loadIdentity();
|
loadIdentity();
|
||||||
Project.gluPerspective(120, 1, 0.05F, 10);
|
|
||||||
|
// Project.gluPerspective(120, 1, 0.05F, 10);
|
||||||
matrixMode(GL11.GL_MODELVIEW);
|
matrixMode(GL11.GL_MODELVIEW);
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
loadIdentity();
|
loadIdentity();
|
||||||
|
@ -164,8 +168,8 @@ public class CubeMap {
|
||||||
private void rotateAndBlurCubemap() {
|
private void rotateAndBlurCubemap() {
|
||||||
mc.getTextureManager().bindTexture(viewportTexture);
|
mc.getTextureManager().bindTexture(viewportTexture);
|
||||||
|
|
||||||
glTexParameteri(3553, 10241, 9729);
|
GL11.glTexParameteri(3553, 10241, 9729);
|
||||||
glTexParameteri(3553, 10240, 9729);
|
GL11.glTexParameteri(3553, 10240, 9729);
|
||||||
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
||||||
enableBlend();
|
enableBlend();
|
||||||
blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||||
|
|
|
@ -21,11 +21,11 @@ import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
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.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.util.InputMappings;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -33,7 +33,7 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -64,7 +64,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
|
|
||||||
private float msgFadeOpacity = 0;
|
private float msgFadeOpacity = 0;
|
||||||
|
|
||||||
private int lastMouseX = 0;
|
private double lastMouseX = 0;
|
||||||
|
|
||||||
private boolean jumpState = false;
|
private boolean jumpState = false;
|
||||||
private boolean sneakState = false;
|
private boolean sneakState = false;
|
||||||
|
@ -83,7 +83,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
private final Edge jumpKey = new Edge(this::jumpToggled) {
|
private final Edge jumpKey = new Edge(this::jumpToggled) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean nextState() {
|
protected boolean nextState() {
|
||||||
return Keyboard.isKeyDown(Keyboard.KEY_SPACE);
|
return InputMappings.isKeyDown(GLFW.GLFW_KEY_SPACE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final Edge sneakKey = new Edge(this::sneakToggled) {
|
private final Edge sneakKey = new Edge(this::sneakToggled) {
|
||||||
|
@ -94,14 +94,14 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
};
|
};
|
||||||
|
|
||||||
public GuiSkins(List<SkinServer> servers) {
|
public GuiSkins(List<SkinServer> servers) {
|
||||||
mc = Minecraft.getMinecraft();
|
mc = Minecraft.getInstance();
|
||||||
GameProfile profile = mc.getSession().getProfile();
|
GameProfile profile = mc.getSession().getProfile();
|
||||||
|
|
||||||
localPlayer = getModel(profile);
|
localPlayer = getModel(profile);
|
||||||
remotePlayer = getModel(profile);
|
remotePlayer = getModel(profile);
|
||||||
|
|
||||||
RenderManager rm = mc.getRenderManager();
|
RenderManager rm = mc.getRenderManager();
|
||||||
rm.renderEngine = mc.getTextureManager();
|
rm.textureManager = mc.getTextureManager();
|
||||||
rm.options = mc.gameSettings;
|
rm.options = mc.gameSettings;
|
||||||
rm.renderViewEntity = localPlayer;
|
rm.renderViewEntity = localPlayer;
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateScreen() {
|
public void tick() {
|
||||||
|
|
||||||
if (!(Keyboard.isKeyDown(Keyboard.KEY_LEFT) || Keyboard.isKeyDown(Keyboard.KEY_RIGHT))) {
|
if (!(InputMappings.isKeyDown(GLFW.GLFW_KEY_LEFT) || InputMappings.isKeyDown(GLFW.GLFW_KEY_RIGHT))) {
|
||||||
updateCounter++;
|
updateCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,17 +264,10 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(GuiButton guiButton) throws IOException {
|
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
if (canTakeEvents()) {
|
lastMouseX = mouseX;
|
||||||
super.actionPerformed(guiButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
|
||||||
if (canTakeEvents()) {
|
|
||||||
super.mouseClicked(mouseX, mouseY, button);
|
|
||||||
|
|
||||||
|
if (canTakeEvents() && super.mouseClicked(mouseX, mouseY, button)) {
|
||||||
int bottom = height - 40;
|
int bottom = height - 40;
|
||||||
int mid = width / 2;
|
int mid = width / 2;
|
||||||
|
|
||||||
|
@ -282,32 +275,41 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
localPlayer.swingArm(EnumHand.MAIN_HAND);
|
localPlayer.swingArm(EnumHand.MAIN_HAND);
|
||||||
remotePlayer.swingArm(EnumHand.MAIN_HAND);
|
remotePlayer.swingArm(EnumHand.MAIN_HAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMouseX = mouseX;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
public boolean mouseDragged(double mouseX, double mouseY, int button, double changeX, double changeY) {
|
||||||
if (canTakeEvents()) {
|
lastMouseX = mouseX;
|
||||||
|
|
||||||
|
if (canTakeEvents() && super.mouseDragged(mouseX, mouseY, button, changeX, changeY)) {
|
||||||
updateCounter -= (lastMouseX - mouseX);
|
updateCounter -= (lastMouseX - mouseX);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
lastMouseX = mouseX;
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char keyChar, int keyCode) throws IOException {
|
public boolean keyPressed(int mouseX, int mouseY, int keyCode) {
|
||||||
if (canTakeEvents()) {
|
if (canTakeEvents()) {
|
||||||
if (keyCode == Keyboard.KEY_LEFT) {
|
if (keyCode == GLFW.GLFW_KEY_LEFT) {
|
||||||
updateCounter -= 5;
|
updateCounter -= 5;
|
||||||
} else if (keyCode == Keyboard.KEY_RIGHT) {
|
} else if (keyCode == GLFW.GLFW_KEY_RIGHT) {
|
||||||
updateCounter += 5;
|
updateCounter += 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chooser.pickingInProgress() && !uploader.uploadInProgress()) {
|
if (!chooser.pickingInProgress() && !uploader.uploadInProgress()) {
|
||||||
super.keyTyped(keyChar, keyCode);
|
return super.keyPressed(mouseX, mouseY, keyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void jumpToggled(boolean jumping) {
|
private void jumpToggled(boolean jumping) {
|
||||||
|
@ -431,7 +433,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
depthMask(true);
|
depthMask(true);
|
||||||
enableDepth();
|
enableDepthTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float mouseX, float partialTick) {
|
private void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float mouseX, float partialTick) {
|
||||||
|
@ -439,16 +441,16 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
|
|
||||||
enableColorMaterial();
|
enableColorMaterial();
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
translate(xPosition, yPosition, 300);
|
translatef(xPosition, yPosition, 300);
|
||||||
|
|
||||||
scale(scale, scale, scale);
|
scalef(scale, scale, scale);
|
||||||
rotate(-15, 1, 0, 0);
|
rotatef(-15, 1, 0, 0);
|
||||||
|
|
||||||
RenderHelper.enableStandardItemLighting();
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
|
||||||
float rot = ((updateCounter + partialTick) * 2.5F) % 360;
|
float rot = ((updateCounter + partialTick) * 2.5F) % 360;
|
||||||
|
|
||||||
rotate(rot, 0, 1, 0);
|
rotatef(rot, 0, 1, 0);
|
||||||
|
|
||||||
float lookFactor = (float)Math.sin((rot * (Math.PI / 180)) + 45);
|
float lookFactor = (float)Math.sin((rot * (Math.PI / 180)) + 45);
|
||||||
float lookX = (float) Math.atan((xPosition - mouseX) / 20) * 30;
|
float lookX = (float) Math.atan((xPosition - mouseX) / 20) * 30;
|
||||||
|
@ -496,7 +498,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
||||||
GL11.glDisable(GL11.GL_CLIP_PLANE1);
|
GL11.glDisable(GL11.GL_CLIP_PLANE1);
|
||||||
GL11.glDisable(GL11.GL_CLIP_PLANE0);
|
GL11.glDisable(GL11.GL_CLIP_PLANE0);
|
||||||
|
|
||||||
disableDepth();
|
disableDepthTest();
|
||||||
enableBlend();
|
enableBlend();
|
||||||
depthMask(false);
|
depthMask(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
||||||
if (entity.isPlayerSleeping()) {
|
if (entity.isPlayerSleeping()) {
|
||||||
BedHead.instance.render(entity);
|
BedHead.instance.render(entity);
|
||||||
}
|
}
|
||||||
if (entity.isRiding()) {
|
if (entity.getRidingEntity() != null) {
|
||||||
MrBoaty.instance.render();
|
MrBoaty.instance.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,17 +166,17 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
||||||
}
|
}
|
||||||
|
|
||||||
static class BedHead extends TileEntityBed {
|
static class BedHead extends TileEntityBed {
|
||||||
public static BedHead instance = new BedHead(Blocks.BED.getDefaultState());
|
public static BedHead instance = new BedHead(Blocks.RED_BED.getDefaultState());
|
||||||
|
|
||||||
public int metadata;
|
public IBlockState state;
|
||||||
|
|
||||||
public BedHead(IBlockState state) {
|
public BedHead(IBlockState state) {
|
||||||
state.getBlock().getMetaFromState(state);
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockMetadata() {
|
public IBlockState getBlockState() {
|
||||||
return metadata;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Entity entity) {
|
public void render(Entity entity) {
|
||||||
|
@ -187,8 +187,8 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
||||||
|
|
||||||
TileEntityRendererDispatcher dispatcher = TileEntityRendererDispatcher.instance;
|
TileEntityRendererDispatcher dispatcher = TileEntityRendererDispatcher.instance;
|
||||||
|
|
||||||
dispatcher.prepare(entity.getEntityWorld(), Minecraft.getInstance().getTextureManager(), Minecraft.getMinecraft().getRenderManager().getFontRenderer(), entity, null, 0);
|
dispatcher.prepare(entity.getEntityWorld(), Minecraft.getInstance().getTextureManager(), Minecraft.getInstance().getRenderManager().getFontRenderer(), entity, null, 0);
|
||||||
dispatcher.getRenderer(this).render(BedHead.instance, -0.5F, 0, 0, 0, -1, 1);
|
dispatcher.getRenderer(this).render(BedHead.instance, -0.5F, 0, 0, 0, -1);
|
||||||
|
|
||||||
popMatrix();
|
popMatrix();
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
|
|
|
@ -3,14 +3,10 @@ package com.minelittlepony.hdskins.upload;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.DefaultResourcePack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.LWJGLException;
|
|
||||||
import org.lwjgl.opengl.Display;
|
|
||||||
import org.lwjgl.opengl.DisplayMode;
|
|
||||||
|
|
||||||
import java.awt.Canvas;
|
import java.awt.Canvas;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
|
@ -32,6 +28,7 @@ import javax.swing.*;
|
||||||
/**
|
/**
|
||||||
* Experimental window to control file drop. It kind of sucks.
|
* Experimental window to control file drop. It kind of sucks.
|
||||||
*
|
*
|
||||||
|
* @deprecated TODO: Merge GLFW branch
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class GLWindow extends DropTarget {
|
public class GLWindow extends DropTarget {
|
||||||
|
@ -75,7 +72,7 @@ public class GLWindow extends DropTarget {
|
||||||
return Math.max((int)Math.round(i * Display.getPixelScaleFactor()), 0);
|
return Math.max((int)Math.round(i * Display.getPixelScaleFactor()), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Minecraft mc = Minecraft.getMinecraft();
|
private final Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
||||||
private JFrame frame;
|
private JFrame frame;
|
||||||
private Canvas canvas;
|
private Canvas canvas;
|
||||||
|
|
|
@ -44,9 +44,7 @@ public class LiteModMineLittlePony implements IModUtilities, InitCompleteListene
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(File configPath) {
|
public void init(File configPath) {
|
||||||
Config config = new Config();
|
mlp.init(new Config());
|
||||||
|
|
||||||
mlp.init(config);
|
|
||||||
|
|
||||||
LiteLoader.getInput().registerKeyBinding(MineLPClient.SETTINGS_GUI);
|
LiteLoader.getInput().registerKeyBinding(MineLPClient.SETTINGS_GUI);
|
||||||
LiteLoader.getInstance().registerExposable(config, null);
|
LiteLoader.getInstance().registerExposable(config, null);
|
||||||
|
@ -83,8 +81,8 @@ public class LiteModMineLittlePony implements IModUtilities, InitCompleteListene
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Timer getGameTimer() {
|
public float getRenderPartialTicks() {
|
||||||
return ((IMinecraft)Minecraft.getInstance()).getTimer();
|
return ((IMinecraft)Minecraft.getInstance()).getTimer().renderPartialTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Panel extends GuiLiteHost {
|
public static class Panel extends GuiLiteHost {
|
||||||
|
|
Loading…
Add table
Reference in a new issue