mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01: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.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Timer;
|
||||
|
||||
public interface IModUtilities {
|
||||
<T extends TileEntity> void addRenderer(Class<T> type, TileEntityRenderer<T> renderer);
|
||||
|
@ -13,5 +12,5 @@ public interface IModUtilities {
|
|||
|
||||
boolean hasFml();
|
||||
|
||||
Timer getGameTimer();
|
||||
float getRenderPartialTicks();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.hdskins.gui;
|
|||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.math.MathHelper;
|
||||
|
||||
/**
|
||||
* @deprecated Replace with RenderSkybox
|
||||
*/
|
||||
@Deprecated
|
||||
public class CubeMap {
|
||||
|
||||
private int updateCounter = 0;
|
||||
|
@ -52,7 +55,7 @@ public class CubeMap {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
@ -74,7 +77,8 @@ public class CubeMap {
|
|||
matrixMode(GL11.GL_PROJECTION);
|
||||
pushMatrix();
|
||||
loadIdentity();
|
||||
Project.gluPerspective(120, 1, 0.05F, 10);
|
||||
|
||||
// Project.gluPerspective(120, 1, 0.05F, 10);
|
||||
matrixMode(GL11.GL_MODELVIEW);
|
||||
pushMatrix();
|
||||
loadIdentity();
|
||||
|
@ -164,8 +168,8 @@ public class CubeMap {
|
|||
private void rotateAndBlurCubemap() {
|
||||
mc.getTextureManager().bindTexture(viewportTexture);
|
||||
|
||||
glTexParameteri(3553, 10241, 9729);
|
||||
glTexParameteri(3553, 10240, 9729);
|
||||
GL11.glTexParameteri(3553, 10241, 9729);
|
||||
GL11.glTexParameteri(3553, 10240, 9729);
|
||||
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
||||
enableBlend();
|
||||
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 net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.util.InputMappings;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -33,7 +33,7 @@ import net.minecraft.util.EnumHand;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -64,7 +64,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
|
||||
private float msgFadeOpacity = 0;
|
||||
|
||||
private int lastMouseX = 0;
|
||||
private double lastMouseX = 0;
|
||||
|
||||
private boolean jumpState = false;
|
||||
private boolean sneakState = false;
|
||||
|
@ -83,7 +83,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
private final Edge jumpKey = new Edge(this::jumpToggled) {
|
||||
@Override
|
||||
protected boolean nextState() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_SPACE);
|
||||
return InputMappings.isKeyDown(GLFW.GLFW_KEY_SPACE);
|
||||
}
|
||||
};
|
||||
private final Edge sneakKey = new Edge(this::sneakToggled) {
|
||||
|
@ -94,14 +94,14 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
};
|
||||
|
||||
public GuiSkins(List<SkinServer> servers) {
|
||||
mc = Minecraft.getMinecraft();
|
||||
mc = Minecraft.getInstance();
|
||||
GameProfile profile = mc.getSession().getProfile();
|
||||
|
||||
localPlayer = getModel(profile);
|
||||
remotePlayer = getModel(profile);
|
||||
|
||||
RenderManager rm = mc.getRenderManager();
|
||||
rm.renderEngine = mc.getTextureManager();
|
||||
rm.textureManager = mc.getTextureManager();
|
||||
rm.options = mc.gameSettings;
|
||||
rm.renderViewEntity = localPlayer;
|
||||
|
||||
|
@ -120,9 +120,9 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
}
|
||||
|
||||
@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++;
|
||||
}
|
||||
|
||||
|
@ -264,17 +264,10 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guiButton) throws IOException {
|
||||
if (canTakeEvents()) {
|
||||
super.actionPerformed(guiButton);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
if (canTakeEvents()) {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
lastMouseX = mouseX;
|
||||
|
||||
if (canTakeEvents() && super.mouseClicked(mouseX, mouseY, button)) {
|
||||
int bottom = height - 40;
|
||||
int mid = width / 2;
|
||||
|
||||
|
@ -282,32 +275,41 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
localPlayer.swingArm(EnumHand.MAIN_HAND);
|
||||
remotePlayer.swingArm(EnumHand.MAIN_HAND);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
lastMouseX = mouseX;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
if (canTakeEvents()) {
|
||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double changeX, double changeY) {
|
||||
lastMouseX = mouseX;
|
||||
|
||||
if (canTakeEvents() && super.mouseDragged(mouseX, mouseY, button, changeX, changeY)) {
|
||||
updateCounter -= (lastMouseX - mouseX);
|
||||
|
||||
return true;
|
||||
}
|
||||
lastMouseX = mouseX;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char keyChar, int keyCode) throws IOException {
|
||||
public boolean keyPressed(int mouseX, int mouseY, int keyCode) {
|
||||
if (canTakeEvents()) {
|
||||
if (keyCode == Keyboard.KEY_LEFT) {
|
||||
if (keyCode == GLFW.GLFW_KEY_LEFT) {
|
||||
updateCounter -= 5;
|
||||
} else if (keyCode == Keyboard.KEY_RIGHT) {
|
||||
} else if (keyCode == GLFW.GLFW_KEY_RIGHT) {
|
||||
updateCounter += 5;
|
||||
}
|
||||
|
||||
if (!chooser.pickingInProgress() && !uploader.uploadInProgress()) {
|
||||
super.keyTyped(keyChar, keyCode);
|
||||
return super.keyPressed(mouseX, mouseY, keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void jumpToggled(boolean jumping) {
|
||||
|
@ -431,7 +433,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
}
|
||||
|
||||
depthMask(true);
|
||||
enableDepth();
|
||||
enableDepthTest();
|
||||
}
|
||||
|
||||
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();
|
||||
pushMatrix();
|
||||
translate(xPosition, yPosition, 300);
|
||||
translatef(xPosition, yPosition, 300);
|
||||
|
||||
scale(scale, scale, scale);
|
||||
rotate(-15, 1, 0, 0);
|
||||
scalef(scale, scale, scale);
|
||||
rotatef(-15, 1, 0, 0);
|
||||
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
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 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_PLANE0);
|
||||
|
||||
disableDepth();
|
||||
disableDepthTest();
|
||||
enableBlend();
|
||||
depthMask(false);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
if (entity.isPlayerSleeping()) {
|
||||
BedHead.instance.render(entity);
|
||||
}
|
||||
if (entity.isRiding()) {
|
||||
if (entity.getRidingEntity() != null) {
|
||||
MrBoaty.instance.render();
|
||||
}
|
||||
|
||||
|
@ -166,17 +166,17 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
}
|
||||
|
||||
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) {
|
||||
state.getBlock().getMetaFromState(state);
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata() {
|
||||
return metadata;
|
||||
public IBlockState getBlockState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void render(Entity entity) {
|
||||
|
@ -187,8 +187,8 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
|
||||
TileEntityRendererDispatcher dispatcher = TileEntityRendererDispatcher.instance;
|
||||
|
||||
dispatcher.prepare(entity.getEntityWorld(), Minecraft.getInstance().getTextureManager(), Minecraft.getMinecraft().getRenderManager().getFontRenderer(), entity, null, 0);
|
||||
dispatcher.getRenderer(this).render(BedHead.instance, -0.5F, 0, 0, 0, -1, 1);
|
||||
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);
|
||||
|
||||
popMatrix();
|
||||
GL11.glPopAttrib();
|
||||
|
|
|
@ -3,14 +3,10 @@ package com.minelittlepony.hdskins.upload;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.DefaultResourcePack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
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.Frame;
|
||||
|
@ -32,6 +28,7 @@ import javax.swing.*;
|
|||
/**
|
||||
* Experimental window to control file drop. It kind of sucks.
|
||||
*
|
||||
* @deprecated TODO: Merge GLFW branch
|
||||
*/
|
||||
@Deprecated
|
||||
public class GLWindow extends DropTarget {
|
||||
|
@ -75,7 +72,7 @@ public class GLWindow extends DropTarget {
|
|||
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 Canvas canvas;
|
||||
|
|
|
@ -44,9 +44,7 @@ public class LiteModMineLittlePony implements IModUtilities, InitCompleteListene
|
|||
|
||||
@Override
|
||||
public void init(File configPath) {
|
||||
Config config = new Config();
|
||||
|
||||
mlp.init(config);
|
||||
mlp.init(new Config());
|
||||
|
||||
LiteLoader.getInput().registerKeyBinding(MineLPClient.SETTINGS_GUI);
|
||||
LiteLoader.getInstance().registerExposable(config, null);
|
||||
|
@ -83,8 +81,8 @@ public class LiteModMineLittlePony implements IModUtilities, InitCompleteListene
|
|||
}
|
||||
|
||||
@Override
|
||||
public Timer getGameTimer() {
|
||||
return ((IMinecraft)Minecraft.getInstance()).getTimer();
|
||||
public float getRenderPartialTicks() {
|
||||
return ((IMinecraft)Minecraft.getInstance()).getTimer().renderPartialTicks;
|
||||
}
|
||||
|
||||
public static class Panel extends GuiLiteHost {
|
||||
|
|
Loading…
Reference in a new issue