diff --git a/installer/Installer.java b/installer/Installer.java index ddf12e3..f74a502 100644 --- a/installer/Installer.java +++ b/installer/Installer.java @@ -33,8 +33,11 @@ public class Installer extends JPanel implements PropertyChangeListener private String tempDir = System.getProperty("java.io.tmpdir"); private static final boolean ALLOW_FORGE_INSTALL = true; - private static final boolean ALLOW_HYDRA_INSTALL = false; // TODO: Change to true once Hydra is fixed up - private static final boolean ALLOW_SHADERSMOD_INSTALL = true; + private static final boolean ALLOW_HYDRA_INSTALL = false; + private static final boolean ALLOW_KATVR_INSTALL = false; + private static final boolean ALLOW_KIOSK_INSTALL = false; + private static final boolean ALLOW_HRTF_INSTALL = true; + private static final boolean ALLOW_SHADERSMOD_INSTALL = false; private static final boolean NEEDS_2010_REDIST = false; private static final boolean NEEDS_2012_REDIST = false; @@ -58,6 +61,12 @@ public class Installer extends JPanel implements PropertyChangeListener private static final String FORGE_VERSION = "12.18.3.2316"; /* END OF DO NOT RENAME */ + private static final String DEFAULT_PROFILE_NAME = "ViveCraft " + MINECRAFT_VERSION; + private static final String DEFAULT_PROFILE_NAME_FORGE = "ViveCraft-Forge " + MINECRAFT_VERSION; + private static final String GITHUB_LINK = "https://github.com/jrbudda/Vivecraft_110"; + private static final String HOMEPAGE_LINK = "http://www.vivecraft.org"; + private static final String DONATION_LINK = "https://www.patreon.com/jrbudda"; + private String mc_url = "https://s3.amazonaws.com/Minecraft.Download/versions/" + MINECRAFT_VERSION + "/" + MINECRAFT_VERSION +".jar"; private InstallTask task; @@ -83,6 +92,8 @@ public class Installer extends JPanel implements PropertyChangeListener private JComboBox forgeVersion; private JCheckBox useHydra; private JCheckBox useHrtf; + private JCheckBox katvr; + private JCheckBox kiosk; private JComboBox ramAllocation; private final boolean QUIET_DEV = false; private File releaseNotes = null; @@ -97,7 +108,12 @@ public class Installer extends JPanel implements PropertyChangeListener private final String smcVanillaMD5 = "4797D91A1F3752EF47242637901199CB"; private final String smcForgeMD5 = "F66374AEA8DDA5F3B7CCB20C230375D7"; - + private JTextField txtCustomProfileName; + private JTextField txtCustomGameDir; + private JCheckBox chkCustomProfileName; + private JCheckBox chkCustomGameDir; + + static private final String forgeNotFound = "Forge not found..." ; private String userHomeDir; @@ -418,185 +434,6 @@ public void run() { } return true; - -/* File versionRootDir = new File(target,"versions"); - File versionTarget = new File(versionRootDir,MINECRAFT_VERSION); - if (!versionTarget.mkdirs() && !versionTarget.isDirectory()) - { - versionTarget.delete(); - versionTarget.mkdirs(); - } - - File librariesDir = new File(target, "libraries"); - List libraries = VersionInfo.getVersionInfo().getArrayNode("libraries"); - monitor.setMaximum(libraries.size() + 3); - int progress = 3; - - File versionJsonFile = new File(versionTarget,VersionInfo.getVersionTarget()+".json"); - - if (!VersionInfo.isInheritedJson()) - { - File clientJarFile = new File(versionTarget, VersionInfo.getVersionTarget()+".jar"); - File minecraftJarFile = VersionInfo.getMinecraftFile(versionRootDir); - - try - { - boolean delete = false; - monitor.setNote("Considering minecraft client jar"); - monitor.setProgress(1); - - if (!minecraftJarFile.exists()) - { - minecraftJarFile = File.createTempFile("minecraft_client", ".jar"); - delete = true; - monitor.setNote(String.format("Downloading minecraft client version %s", VersionInfo.getMinecraftVersion())); - String clientUrl = String.format(DownloadUtils.VERSION_URL_CLIENT.replace("{MCVER}", VersionInfo.getMinecraftVersion())); - System.out.println(" Temp File: " + minecraftJarFile.getAbsolutePath()); - - if (!DownloadUtils.downloadFileEtag("minecraft server", minecraftJarFile, clientUrl)) - { - minecraftJarFile.delete(); - JOptionPane.showMessageDialog(null, "Downloading minecraft failed, invalid e-tag checksum.\n" + - "Try again, or use the official launcher to run Minecraft " + - VersionInfo.getMinecraftVersion() + " first.", - "Error downloading", JOptionPane.ERROR_MESSAGE); - return false; - } - monitor.setProgress(2); - } - - if (VersionInfo.getStripMetaInf()) - { - monitor.setNote("Copying and filtering minecraft client jar"); - copyAndStrip(minecraftJarFile, clientJarFile); - monitor.setProgress(3); - } - else - { - monitor.setNote("Copying minecraft client jar"); - Files.copy(minecraftJarFile, clientJarFile); - monitor.setProgress(3); - } - - if (delete) - { - minecraftJarFile.delete(); - } - } - catch (IOException e1) - { - JOptionPane.showMessageDialog(null, "You need to run the version "+VersionInfo.getMinecraftVersion()+" manually at least once", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - } - - File targetLibraryFile = VersionInfo.getLibraryPath(librariesDir); - grabbed = Lists.newArrayList(); - List bad = Lists.newArrayList(); - progress = DownloadUtils.downloadInstalledLibraries("clientreq", librariesDir, monitor, libraries, progress, grabbed, bad); - - monitor.close(); - if (bad.size() > 0) - { - String list = Joiner.on("\n").join(bad); - JOptionPane.showMessageDialog(null, "These libraries failed to download. Try again.\n"+list, "Error downloading", JOptionPane.ERROR_MESSAGE); - return false; - } - - if (!targetLibraryFile.getParentFile().mkdirs() && !targetLibraryFile.getParentFile().isDirectory()) - { - if (!targetLibraryFile.getParentFile().delete()) - { - JOptionPane.showMessageDialog(null, "There was a problem with the launcher version data. You will need to clear "+targetLibraryFile.getAbsolutePath()+" manually", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - else - { - targetLibraryFile.getParentFile().mkdirs(); - } - } - - - JsonRootNode versionJson = JsonNodeFactories.object(VersionInfo.getVersionInfo().getFields()); - - try - { - BufferedWriter newWriter = Files.newWriter(versionJsonFile, Charsets.UTF_8); - PrettyJsonFormatter.fieldOrderPreservingPrettyJsonFormatter().format(versionJson,newWriter); - newWriter.close(); - } - catch (Exception e) - { - JOptionPane.showMessageDialog(null, "There was a problem writing the launcher version data, is it write protected?", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - - try - { - VersionInfo.extractFile(targetLibraryFile); - } - catch (IOException e) - { - JOptionPane.showMessageDialog(null, "There was a problem writing the system library file", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - - JdomParser parser = new JdomParser(); - JsonRootNode jsonProfileData; - - try - { - jsonProfileData = parser.parse(Files.newReader(launcherProfiles, Charsets.UTF_8)); - } - catch (InvalidSyntaxException e) - { - JOptionPane.showMessageDialog(null, "The launcher profile file is corrupted. Re-run the minecraft launcher to fix it!", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - catch (Exception e) - { - throw Throwables.propagate(e); - } - - - - - HashMap profileCopy = Maps.newHashMap(jsonProfileData.getNode("profiles").getFields()); - HashMap rootCopy = Maps.newHashMap(jsonProfileData.getFields()); - if(profileCopy.containsKey(JsonNodeFactories.string(VersionInfo.getProfileName()))) - { - HashMap forgeProfileCopy = Maps.newHashMap(profileCopy.get(JsonNodeFactories.string(VersionInfo.getProfileName())).getFields()); - forgeProfileCopy.put(JsonNodeFactories.string("name"), JsonNodeFactories.string(VersionInfo.getProfileName())); - forgeProfileCopy.put(JsonNodeFactories.string("lastVersionId"), JsonNodeFactories.string(VersionInfo.getVersionTarget())); - } - else - { - JsonField[] fields = new JsonField[] { - JsonNodeFactories.field("name", JsonNodeFactories.string(VersionInfo.getProfileName())), - JsonNodeFactories.field("lastVersionId", JsonNodeFactories.string(VersionInfo.getVersionTarget())), - }; - profileCopy.put(JsonNodeFactories.string(VersionInfo.getProfileName()), JsonNodeFactories.object(fields)); - } - JsonRootNode profileJsonCopy = JsonNodeFactories.object(profileCopy); - rootCopy.put(JsonNodeFactories.string("profiles"), profileJsonCopy); - - jsonProfileData = JsonNodeFactories.object(rootCopy); - - try - { - BufferedWriter newWriter = Files.newWriter(launcherProfiles, Charsets.UTF_8); - PrettyJsonFormatter.fieldOrderPreservingPrettyJsonFormatter().format(jsonProfileData,newWriter); - newWriter.close(); - } - catch (Exception e) - { - JOptionPane.showMessageDialog(null, "There was a problem writing the launch profile, is it write protected?", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - */ - - -// return success; } private boolean SetupMinecraftAsLibrary() { @@ -696,12 +533,12 @@ public int read(byte[] buff) throws IOException { //modify json args if needed try { int jsonIndentSpaces = 2; - String profileName = getMinecraftProfileName(useForge.isSelected(), useShadersMod.isSelected()); File fileJson = ver_json_file; String json = readAsciiFile(fileJson); JSONObject root = new JSONObject(json); String args = (String)root.get("minecraftArguments"); - args += " --test"; + if(katvr.isSelected()) args += " --katvr"; + if(kiosk.isSelected()) args += " --kiosk"; root.put("minecraftArguments", args); FileWriter fwJson = new FileWriter(fileJson); fwJson.write(root.toString(jsonIndentSpaces)); @@ -722,13 +559,6 @@ public int read(byte[] buff) throws IOException { } ver_jar.close(); - //Create empty version jar file - //All code actually lives in libraries/ - //1/2017 - dont do this anymore - better errors. - // ZipOutputStream null_jar = new ZipOutputStream(new FileOutputStream(new File (ver_dir, jar_id+".jar"))); - // null_jar.putNextEntry(new ZipEntry("Classes actually in libraries directory")); - // null_jar.closeEntry(); - // null_jar.close(); return ver_json_file.exists() && ver_file.exists(); } catch (Exception e) { finalMessage += " Error: "+e.getLocalizedMessage(); @@ -780,11 +610,20 @@ private boolean InstallOpenVR() { String resource = "win32/openvr_api.dll"; if (osname.contains("windows")){ + installFile(osFolder, resource); + osFolder = "win64"; + resource = "win64/openvr_api.dll"; installFile(osFolder, resource); - osFolder = "win64"; - resource = "win64/openvr_api.dll"; - installFile(osFolder, resource); + + if(katvr.isSelected()){ + installFile("katvr", "katvr/WalkerBase.dll"); + installFile("katvr", "katvr/msvcp120d.dll"); + installFile("katvr", "katvr/msvcp140d.dll"); + installFile("katvr", "katvr/msvcr120d.dll"); + installFile("katvr", "katvr/vcruntime140d.dll"); + installFile("katvr", "katvr/ucrtbased.dll"); + } } else if( osname.contains("linux")){ osFolder = "linux32"; @@ -807,9 +646,10 @@ private boolean installFile(String osFolder, String resource){ win32_dir.mkdirs(); InputStream openvrdll = Installer.class.getResourceAsStream(resource); File dll_out = new File (targetDir, resource); - if (!copyInputStreamToFile(openvrdll, dll_out)) + if (!copyInputStreamToFile(openvrdll, dll_out)){ return false; - + } + return true; } @@ -1097,6 +937,7 @@ public Void doInBackground() } } boolean profileCreated = false; + finalMessage = "Failed: Couldn't setup profile!"; if (createProfile.isSelected()) { monitor.setProgress(95); @@ -1215,6 +1056,9 @@ private boolean updateLauncherJson(File mcBaseDirFile, String minecriftVer) try { int jsonIndentSpaces = 2; String profileName = getMinecraftProfileName(useForge.isSelected(), useShadersMod.isSelected()); + if(chkCustomProfileName.isSelected() && txtCustomProfileName.getText().trim() != ""){ + profileName = txtCustomProfileName.getText(); + } File fileJson = new File(mcBaseDirFile, "launcher_profiles.json"); String json = readAsciiFile(fileJson); JSONObject root = new JSONObject(json); @@ -1225,7 +1069,9 @@ private boolean updateLauncherJson(File mcBaseDirFile, String minecriftVer) try { prof = (JSONObject) profiles.get(profileName); } - catch (Exception e) {} + catch (Exception e) { + //this is normal if doesnt exist. + } java.text.DateFormat dateFormat=new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); if (prof == null) { prof = new JSONObject(); @@ -1240,6 +1086,9 @@ private boolean updateLauncherJson(File mcBaseDirFile, String minecriftVer) prof.put("javaArgs", "-Xmx" + ramAllocation.getSelectedItem() + "G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn256M -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true"); root.put("selectedProfile", profileName); prof.put("lastUsed", dateFormat.format(new java.util.Date())); + if(chkCustomGameDir.isSelected() && txtCustomGameDir.getText().trim() != ""){ + prof.put("gameDir", txtCustomGameDir.getText()); + } FileWriter fwJson = new FileWriter(fileJson); fwJson.write(root.toString(jsonIndentSpaces)); @@ -1280,6 +1129,38 @@ public void actionPerformed(ActionEvent e) } } + private class GameDirSelectAction extends AbstractAction + { + @Override + public void actionPerformed(ActionEvent e) + { + JFileChooser dirChooser = new JFileChooser(); + dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + dirChooser.setFileHidingEnabled(false); + dirChooser.ensureFileIsVisible(targetDir); + dirChooser.setSelectedFile(targetDir); + int response = dirChooser.showOpenDialog(Installer.this); + switch (response) + { + case JFileChooser.APPROVE_OPTION: + txtCustomGameDir.setText(dirChooser.getSelectedFile().toString()); + break; + default: + break; + } + } + } + + private class updateTxtEnabled extends AbstractAction + { + @Override + public void actionPerformed(ActionEvent e) + { + txtCustomProfileName.setEditable(chkCustomProfileName.isSelected()); + } + } + + private class updateActionF extends AbstractAction { @Override @@ -1298,7 +1179,7 @@ public void actionPerformed(ActionEvent e) } } - private class updateActionP extends AbstractAction + private class updateActionP extends AbstractAction { @Override public void actionPerformed(ActionEvent e) @@ -1306,10 +1187,12 @@ public void actionPerformed(ActionEvent e) updateInstructions(); } } - - - public Installer(File targetDir) + + public Installer(File target) { + this.setMaximumSize(new Dimension(640,780)); + this.setPreferredSize(new Dimension(640,780)); + targetDir = target; ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); @@ -1321,7 +1204,7 @@ public Installer(File targetDir) image = ImageIO.read(Installer.class.getResourceAsStream("logo.png")); ImageIcon icon = new ImageIcon(image); JLabel logoLabel = new JLabel(icon); - logoLabel.setAlignmentX(CENTER_ALIGNMENT); + logoLabel.setAlignmentX(LEFT_ALIGNMENT); logoLabel.setAlignmentY(CENTER_ALIGNMENT); logoLabel.setSize(image.getWidth(), image.getHeight()); if (!QUIET_DEV) // VIVE - hide oculus logo @@ -1361,38 +1244,44 @@ public Installer(File targetDir) } JLabel tag = new JLabel("Welcome! This will install Vivecraft "+ version); - tag.setAlignmentX(CENTER_ALIGNMENT); + tag.setAlignmentX(LEFT_ALIGNMENT); tag.setAlignmentY(CENTER_ALIGNMENT); logoSplash.add(tag); logoSplash.add(Box.createRigidArea(new Dimension(5,20))); tag = new JLabel("Select path to minecraft. (The default here is almost always what you want.)"); - tag.setAlignmentX(CENTER_ALIGNMENT); + tag.setAlignmentX(LEFT_ALIGNMENT); tag.setAlignmentY(CENTER_ALIGNMENT); logoSplash.add(tag); - logoSplash.setAlignmentX(CENTER_ALIGNMENT); + logoSplash.setAlignmentX(LEFT_ALIGNMENT); logoSplash.setAlignmentY(TOP_ALIGNMENT); - this.add(logoSplash); + this.add(logoSplash); JPanel entryPanel = new JPanel(); entryPanel.setLayout(new BoxLayout(entryPanel,BoxLayout.X_AXIS)); - - Installer.targetDir = targetDir; + entryPanel.setAlignmentX(LEFT_ALIGNMENT); + entryPanel.setAlignmentY(TOP_ALIGNMENT); + selectedDirText = new JTextField(); selectedDirText.setEditable(false); selectedDirText.setToolTipText("Path to minecraft"); - selectedDirText.setColumns(30); - entryPanel.add(selectedDirText); + selectedDirText.setAlignmentX(LEFT_ALIGNMENT); + selectedDirText.setAlignmentY(TOP_ALIGNMENT); + selectedDirText.setMaximumSize(new Dimension(400,20)); + JButton dirSelect = new JButton(); + dirSelect.setMaximumSize(new Dimension(20,20)); dirSelect.setAction(new FileSelectAction()); dirSelect.setText("..."); dirSelect.setToolTipText("Select an alternative minecraft directory"); + dirSelect.setAlignmentX(LEFT_ALIGNMENT); + dirSelect.setAlignmentY(TOP_ALIGNMENT); + + entryPanel.add(selectedDirText); entryPanel.add(dirSelect); - entryPanel.setAlignmentX(LEFT_ALIGNMENT); - entryPanel.setAlignmentY(TOP_ALIGNMENT); infoLabel = new JLabel(); infoLabel.setHorizontalTextPosition(JLabel.LEFT); infoLabel.setVerticalTextPosition(JLabel.TOP); @@ -1402,20 +1291,20 @@ public Installer(File targetDir) fileEntryPanel = new JPanel(); fileEntryPanel.setLayout(new BoxLayout(fileEntryPanel,BoxLayout.Y_AXIS)); - fileEntryPanel.add(infoLabel); - fileEntryPanel.add(entryPanel); - - fileEntryPanel.setAlignmentX(CENTER_ALIGNMENT); + fileEntryPanel.setAlignmentX(LEFT_ALIGNMENT); fileEntryPanel.setAlignmentY(TOP_ALIGNMENT); + + fileEntryPanel.add(entryPanel); + fileEntryPanel.add(infoLabel); + this.add(fileEntryPanel); + this.add(Box.createVerticalStrut(5)); - JPanel optPanel = new JPanel(); - optPanel.setLayout( new BoxLayout(optPanel, BoxLayout.Y_AXIS)); - optPanel.setAlignmentX(LEFT_ALIGNMENT); - optPanel.setAlignmentY(TOP_ALIGNMENT); - //Add forge options + + //Forge Options + JPanel forgePanel = new JPanel(); forgePanel.setLayout( new BoxLayout(forgePanel, BoxLayout.X_AXIS)); //Create forge: no/yes buttons @@ -1423,14 +1312,12 @@ public Installer(File targetDir) AbstractAction actf = new updateActionF(); actf.putValue(AbstractAction.NAME, "Install Vivecraft with Forge " + FORGE_VERSION); useForge.setAction(actf); - useForge.setSelected(true); forgeVersion = new JComboBox(); if (!ALLOW_FORGE_INSTALL) useForge.setEnabled(false); useForge.setToolTipText( "" + - "If checked, installs Vivecraft with Forge support. The correct version of Forge
" + - "(as displayed) must already be installed.
" + + "If checked, installs Vivecraft with Forge support.
" + ""); //Add "yes" and "which version" to the forgePanel @@ -1440,7 +1327,7 @@ public Installer(File targetDir) forgePanel.add(useForge); //forgePanel.add(forgeVersion); - // Profile creation / update support + //Create Profile createProfile = new JCheckBox("", true); AbstractAction actp = new updateActionP(); actp.putValue(AbstractAction.NAME, "Create Vivecraft launcher profile"); @@ -1449,33 +1336,11 @@ public Installer(File targetDir) createProfile.setSelected(true); createProfile.setToolTipText( "" + - "If checked, if a Vivecraft profile doesn't already exist within the Minecraft launcher
" + - "one is added. Then the profile is selected, and this Vivecraft version is set as the
" + - "current version.
" + + "Creates or updates a Minecraft Launcher profile for Vivecraft with the selected settings.
" + + "You should typically leave this checked." + ""); - useShadersMod = new JCheckBox(); - useShadersMod.setAlignmentX(LEFT_ALIGNMENT); - if (!ALLOW_SHADERSMOD_INSTALL) - useShadersMod.setEnabled(false); - AbstractAction acts = new updateActionSM(); - acts.putValue(AbstractAction.NAME, "Install Vivecraft with ShadersMod 2.3.29"); - useShadersMod.setAction(acts); - useShadersMod.setToolTipText( - "" + - "If checked, sets the vivecraft profile to use ShadersMod
" + - "support." + - ""); - - useHydra = new JCheckBox("Razer Hydra support",false); - useHydra.setAlignmentX(LEFT_ALIGNMENT); - if (!ALLOW_HYDRA_INSTALL) - useHydra.setEnabled(false); - useHydra.setToolTipText( - "" + - "If checked, installs the additional Razor Hydra native library required for Razor Hydra
" + - "support." + - ""); + //Binaural Audio useHrtf = new JCheckBox("Enable binaural audio (Only needed once per PC)", false); useHrtf.setToolTipText( @@ -1489,6 +1354,20 @@ public Installer(File targetDir) ""); useHrtf.setAlignmentX(LEFT_ALIGNMENT); + //ShadersMod + + useShadersMod = new JCheckBox(); + useShadersMod.setAlignmentX(LEFT_ALIGNMENT); + AbstractAction acts = new updateActionSM(); + acts.putValue(AbstractAction.NAME, "Install Vivecraft with ShadersMod 2.3.29"); + useShadersMod.setAction(acts); + useShadersMod.setToolTipText( + "" + + "If checked, sets the vivecraft profile to use ShadersMod
" + + "support." + + ""); + + //RAM Allocation JPanel ramPanel = new JPanel(); ramPanel.setLayout( new BoxLayout(ramPanel, BoxLayout.X_AXIS)); @@ -1498,42 +1377,124 @@ public Installer(File targetDir) Integer[] rams = {1,2,4,6,8}; ramAllocation = new JComboBox(rams); - ramAllocation.setSelectedIndex(2); + ramAllocation.setSelectedIndex(1); ramAllocation.setToolTipText( "" + - "Select the amount of Ram, in GB to allocate to the Vivecraft profile." + + "Select the amount of Ram, in GB to allocate to the Vivecraft profile.
" + "At least 2GB is recommened. More than 1GB of ram requires 64 bit PC and java." + ""); ramAllocation.setAlignmentX(LEFT_ALIGNMENT); - ramAllocation.setMaximumSize( ramAllocation.getPreferredSize() ); + ramAllocation.setMaximumSize( new Dimension((int)ramAllocation.getPreferredSize().getWidth(), 20)); + - JLabel ram = new JLabel(" Profile Ram Allocation (GB)"); + JLabel ram = new JLabel(" Profile Ram Allocation (GB) "); ram.setAlignmentX(LEFT_ALIGNMENT); ramPanel.add(ram); ramPanel.add(ramAllocation); - optPanel.add(forgePanel); - //optPanel.add(useShadersMod); - optPanel.add(createProfile); - optPanel.add(ramPanel); - optPanel.add(useHrtf); - this.add(optPanel); + //Custom Profile - this.add(Box.createRigidArea(new Dimension(5,20))); + JPanel namePanel = new JPanel(); + namePanel.setLayout( new BoxLayout(namePanel, BoxLayout.X_AXIS)); + namePanel.setAlignmentX(LEFT_ALIGNMENT); + namePanel.setAlignmentY(TOP_ALIGNMENT); + + txtCustomProfileName = new JTextField(); + txtCustomProfileName.setAlignmentX(LEFT_ALIGNMENT); + txtCustomProfileName.setMaximumSize(new Dimension(250,20)); + txtCustomProfileName.setEditable(false); + + chkCustomProfileName = new JCheckBox(); + chkCustomProfileName.setAlignmentX(LEFT_ALIGNMENT); + AbstractAction u = new updateTxtEnabled(); + u.putValue(AbstractAction.NAME, "Custom Profile Name"); + chkCustomProfileName.setAction(u); + chkCustomProfileName.setToolTipText( + "" + + "Enter a custom name for this profile"); + + namePanel.add(Box.createRigidArea(new Dimension(36,20))); + namePanel.add(chkCustomProfileName); + namePanel.add(txtCustomProfileName); + + // Custom Game Dir + + JPanel gameDirPanel = new JPanel(); + gameDirPanel.setLayout( new BoxLayout(gameDirPanel, BoxLayout.X_AXIS)); + gameDirPanel.setAlignmentX(LEFT_ALIGNMENT); + gameDirPanel.setAlignmentY(TOP_ALIGNMENT); + + txtCustomGameDir= new JTextField(); + txtCustomGameDir.setAlignmentX(LEFT_ALIGNMENT); + txtCustomGameDir.setMaximumSize(new Dimension(400,20)); + txtCustomGameDir.setEditable(false); + + chkCustomGameDir = new JCheckBox("Modpack Directory"); + chkCustomGameDir.setAlignmentX(LEFT_ALIGNMENT); + chkCustomGameDir.setToolTipText( + "" + + "Points the profile at a different game directory.
" + + "Select this to use Vivecraft with a modpack.
" + + "The game directory should contain the 'mods' " + + "directory of the desired pack." + + ""); + JButton gdirSelect = new JButton(); + gdirSelect.setAction(new GameDirSelectAction()); + gdirSelect.setText("..."); + gdirSelect.setMaximumSize(new Dimension(20,20)); + gdirSelect.setToolTipText("Select a modpack directory"); + entryPanel.add(gdirSelect); + + gameDirPanel.add(Box.createRigidArea(new Dimension(36,20))); + gameDirPanel.add(chkCustomGameDir); + gameDirPanel.add(txtCustomGameDir); + gameDirPanel.add(gdirSelect); + + // KATVR + + katvr = new JCheckBox("KATVR Driver", false); + katvr.setToolTipText( + "" + + "If checked, install the drivers needed for KATVR Treadmill
" + + "DO NOT select this unless you have the KATVR runtime installed."); + katvr.setAlignmentX(LEFT_ALIGNMENT); + + + kiosk = new JCheckBox("Kiosk Mode", false); + kiosk.setToolTipText( + "" + + "If checked, disables use of in-game menu via controller" + + ""); + kiosk.setAlignmentX(LEFT_ALIGNMENT); + + this.add(forgePanel); + if(ALLOW_SHADERSMOD_INSTALL) this.add(useShadersMod); + this.add(createProfile); + this.add(ramPanel); + this.add(namePanel); + this.add(gameDirPanel); + if(ALLOW_HRTF_INSTALL)this.add(useHrtf); + this.add(new JLabel(" ")); + if(ALLOW_KATVR_INSTALL||ALLOW_KIOSK_INSTALL) this.add(new JLabel("Advanced Options")); + if(ALLOW_KIOSK_INSTALL) this.add(kiosk); + if(ALLOW_KATVR_INSTALL) this.add(katvr); + + this.add(Box.createRigidArea(new Dimension(5,20))); + instructions = new JLabel("",SwingConstants.CENTER); instructions.setAlignmentX(CENTER_ALIGNMENT); instructions.setAlignmentY(TOP_ALIGNMENT); instructions.setForeground(Color.RED); instructions.setPreferredSize(new Dimension(20, 40)); - this.add(instructions); + this.add(instructions); this.add(Box.createVerticalGlue()); - JLabel github = linkify("Vivecraft is open source. find it on Github","https://github.com/jrbudda/Vivecraft_110","Vivecraft 1.10 Github"); - JLabel wiki = linkify("Vivecraft home page","http://www.vivecraft.org","Vivecraft Home"); - JLabel donate = linkify("If you think Vivecraft is awesome, please consider donating.","https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JVBJLN5HJJS52&lc=US&item_name=jrbudda¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)","jrbudda's Paypal"); + JLabel github = linkify("Vivecraft is open source. find it on Github",GITHUB_LINK,"Vivecraft Github"); + JLabel wiki = linkify("Vivecraft home page",HOMEPAGE_LINK,"Vivecraft Home"); + JLabel donate = linkify("If you think Vivecraft is awesome, please consider supporting us on Patreon",DONATION_LINK,"jrbudda's Patreon"); JLabel optifine = linkify("Vivecraft includes OptiFine for performance. Consider donating to them as well.","http://optifine.net/donate.php","http://optifine.net/donate.php"); github.setAlignmentX(CENTER_ALIGNMENT); @@ -1550,26 +1511,23 @@ public Installer(File targetDir) this.add( wiki ); this.add( donate ); this.add( optifine ); - - this.setAlignmentX(LEFT_ALIGNMENT); updateFilePath(); updateInstructions(); } - private void updateInstructions(){ String out = ""; if(createProfile.isSelected()){ out += "Please make sure the Minecraft Launcher is not running."; + if(chkCustomProfileName.isSelected() == false){ + txtCustomProfileName.setText(getMinecraftProfileName(useForge.isSelected(), useShadersMod.isSelected())); + } } ramAllocation.setSelectedIndex(1); if (useForge.isSelected()){ ramAllocation.setSelectedIndex(2); out += "
Please make sure Forge has been installed first."; } - if (useForge.isSelected() && useShadersMod.isSelected()){ - // out += "Please make sure that ShadersModCore is NOT in your Forge mods folder!"; - } out+=""; instructions.setText(out); ramAllocation.setEnabled(createProfile.isSelected()); @@ -1690,15 +1648,8 @@ public void mouseReleased(MouseEvent e) { private String getMinecraftProfileName(boolean usingForge, boolean sm) { - if(!usingForge) { - if(sm) - return "ViveCraft-ShadersMod " + MINECRAFT_VERSION; - else - return "ViveCraft " + MINECRAFT_VERSION; - } else if(sm) - return "ViveCraft-SM-Forge " + MINECRAFT_VERSION; - else - return "ViveCraft-Forge " + MINECRAFT_VERSION; + if(!usingForge) return DEFAULT_PROFILE_NAME; + else return DEFAULT_PROFILE_NAME_FORGE; } public static String readAsciiFile(File file) diff --git a/minecriftversion.py b/minecriftversion.py index 67823d2..ca324bd 100644 --- a/minecriftversion.py +++ b/minecriftversion.py @@ -4,7 +4,7 @@ of_json_name = "1.10.2_HD_U_E3" of_file_md5 = "7ea7d7c1e353da2a94961b443e59026f" minecrift_version_num = "1.10.2" -minecrift_build = "jrbudda-11r2" +minecrift_build = "jrbudda-12b" of_file_extension = ".jar" mcp_version = "mcp931" mcp_uses_generics = True diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index 3a56c2d..a71f79b 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -306,7 +306,7 @@ + * The minecriftVerString will be automatically updated by the build scripts, do not modify here. + * Modify minecriftversion.py in root minecrift dir. + */ -+ public final String minecriftVerString = "Vivecraft 1.10.2 jrbudda-11r2"; ++ public final String minecriftVerString = "Vivecraft 1.10.2 jrbudda-12b"; + /* end version */ + /** END MINECRIFT */ + @@ -1379,7 +1379,7 @@ { return; } -@@ -1616,25 +2212,20 @@ +@@ -1616,25 +2212,21 @@ case BLOCK: BlockPos blockpos = this.objectMouseOver.getBlockPos(); @@ -1389,7 +1389,8 @@ - int i = itemstack != null ? itemstack.stackSize : 0; - EnumActionResult enumactionresult = this.playerController.processRightClickBlock(this.player, this.world, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec, enumhand); - -+ int i = itemstack != null ? itemstack.stackSize : 0; EnumActionResult enumactionresult = this.playerController.processRightClickBlock(this.player, this.world, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec, enumhand); ++ int i = itemstack != null ? itemstack.stackSize : 0; ++ EnumActionResult enumactionresult = this.playerController.processRightClickBlock(this.player, this.world, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec, enumhand); if (enumactionresult == EnumActionResult.SUCCESS) { this.player.swingArm(enumhand); @@ -1413,7 +1414,7 @@ } return; -@@ -1643,9 +2234,7 @@ +@@ -1643,9 +2235,7 @@ } } @@ -1424,7 +1425,7 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand); return; -@@ -1720,29 +2309,14 @@ +@@ -1720,29 +2310,14 @@ /** * Called to resize the current screen. */ @@ -1457,7 +1458,7 @@ } /** -@@ -1758,11 +2332,21 @@ +@@ -1758,11 +2333,21 @@ */ public void runTick() throws IOException { @@ -1479,7 +1480,7 @@ this.mcProfiler.startSection("gui"); if (!this.isGamePaused) -@@ -1861,12 +2445,23 @@ +@@ -1861,12 +2446,23 @@ this.mcProfiler.endStartSection("keyboard"); this.runTickKeyboard(); @@ -1503,7 +1504,7 @@ ++this.joinPlayerCounter; if (this.joinPlayerCounter == 30) -@@ -1874,6 +2469,10 @@ +@@ -1874,6 +2470,10 @@ this.joinPlayerCounter = 0; this.world.joinEntityInSurroundings(this.player); } @@ -1514,7 +1515,7 @@ } this.mcProfiler.endStartSection("gameRenderer"); -@@ -1907,6 +2506,9 @@ +@@ -1907,6 +2507,9 @@ this.entityRenderer.stopUseShader(); } @@ -1524,7 +1525,7 @@ if (!this.isGamePaused) { this.mcMusicTicker.update(); -@@ -1960,8 +2562,12 @@ +@@ -1960,8 +2563,12 @@ this.mcProfiler.endStartSection("pendingConnection"); this.myNetworkManager.processReceivedPackets(); } @@ -1538,7 +1539,7 @@ this.systemTime = getSystemTime(); } -@@ -1996,8 +2602,15 @@ +@@ -1996,8 +2603,15 @@ this.currentScreen.handleKeyboardInput(); } @@ -1555,7 +1556,7 @@ if (flag) { if (i == 62 && this.entityRenderer != null) -@@ -2005,6 +2618,8 @@ +@@ -2005,6 +2619,8 @@ this.entityRenderer.switchUseShader(); } @@ -1564,7 +1565,7 @@ boolean flag1 = false; if (this.currentScreen == null) -@@ -2012,6 +2627,7 @@ +@@ -2012,6 +2628,7 @@ if (i == 1) { this.displayInGameMenu(); @@ -1572,7 +1573,7 @@ } flag1 = Keyboard.isKeyDown(61) && this.processKeyF3(i); -@@ -2019,7 +2635,9 @@ +@@ -2019,7 +2636,9 @@ if (i == 59) { @@ -1583,7 +1584,7 @@ } } -@@ -2032,6 +2650,7 @@ +@@ -2032,6 +2651,7 @@ KeyBinding.setKeyBindState(i, true); KeyBinding.onTick(i); } @@ -1591,7 +1592,7 @@ if (this.gameSettings.showDebugProfilerChart) { -@@ -2052,7 +2671,6 @@ +@@ -2052,7 +2672,6 @@ else { KeyBinding.setKeyBindState(i, false); @@ -1599,7 +1600,7 @@ if (i == 61) { if (this.actionKeyF3) -@@ -2067,6 +2685,11 @@ +@@ -2067,6 +2686,11 @@ } } } @@ -1611,7 +1612,7 @@ } this.processKeyBinds(); -@@ -2171,20 +2794,38 @@ +@@ -2171,20 +2795,38 @@ { for (; this.gameSettings.keyBindTogglePerspective.isPressed(); this.renderGlobal.setDisplayListEntitiesDirty()) { @@ -1664,7 +1665,7 @@ } } -@@ -2207,7 +2848,7 @@ +@@ -2207,7 +2849,7 @@ } } } @@ -1673,7 +1674,7 @@ while (this.gameSettings.keyBindInventory.isPressed()) { this.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.OPEN_INVENTORY_ACHIEVEMENT)); -@@ -2242,22 +2883,42 @@ +@@ -2242,22 +2884,42 @@ if (flag) { @@ -1723,7 +1724,7 @@ } label472: -@@ -2283,17 +2944,27 @@ +@@ -2283,17 +2945,27 @@ } } } @@ -1759,7 +1760,7 @@ while (this.gameSettings.keyBindPickBlock.isPressed()) { -@@ -2301,18 +2972,23 @@ +@@ -2301,18 +2973,23 @@ } } @@ -1786,7 +1787,7 @@ int i = Mouse.getEventButton(); KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); -@@ -2327,6 +3003,13 @@ +@@ -2327,6 +3004,13 @@ KeyBinding.onTick(i - 100); } } @@ -1800,7 +1801,7 @@ long j = getSystemTime() - this.systemTime; -@@ -2381,6 +3064,15 @@ +@@ -2381,6 +3065,15 @@ */ public void launchIntegratedServer(String folderName, String worldName, @Nullable WorldSettings worldSettingsIn) { @@ -1816,7 +1817,7 @@ this.loadWorld((WorldClient)null); System.gc(); ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2423,6 +3115,16 @@ +@@ -2423,6 +3116,16 @@ while (!this.theIntegratedServer.serverIsInRunLoop()) { @@ -1833,7 +1834,7 @@ String s = this.theIntegratedServer.getUserMessage(); if (s != null) -@@ -2443,12 +3145,19 @@ +@@ -2443,12 +3146,19 @@ ; } } @@ -1855,7 +1856,7 @@ networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile())); this.myNetworkManager = networkmanager; } -@@ -2458,6 +3167,9 @@ +@@ -2458,6 +3168,9 @@ */ public void loadWorld(WorldClient worldClientIn) { @@ -1865,7 +1866,7 @@ this.loadWorld(worldClientIn, ""); } -@@ -2466,6 +3178,11 @@ +@@ -2466,6 +3179,11 @@ */ public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) { @@ -1877,7 +1878,7 @@ if (worldClientIn == null) { NetHandlerPlayClient nethandlerplayclient = this.getConnection(); -@@ -2477,9 +3194,25 @@ +@@ -2477,9 +3195,25 @@ if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) { @@ -1905,7 +1906,7 @@ this.theIntegratedServer = null; this.guiAchievement.clearAchievements(); this.entityRenderer.getMapItemRenderer().clearLoadedMaps(); -@@ -2501,6 +3234,11 @@ +@@ -2501,6 +3235,11 @@ this.ingameGUI.resetPlayersOverlayFooterHeader(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -1917,7 +1918,7 @@ } this.mcSoundHandler.stopSounds(); -@@ -2533,12 +3271,14 @@ +@@ -2533,12 +3272,14 @@ if (this.player == null) { @@ -1933,7 +1934,7 @@ this.player.movementInput = new MovementInputFromOptions(this.gameSettings); this.playerController.setPlayerCapabilities(this.player); this.renderViewEntity = this.player; -@@ -2576,6 +3316,7 @@ +@@ -2576,6 +3317,7 @@ this.player.preparePlayerToSpawn(); this.player.setServerBrand(s); this.world.spawnEntity(this.player); @@ -1941,7 +1942,7 @@ this.playerController.flipPlayer(this.player); this.player.movementInput = new MovementInputFromOptions(this.gameSettings); this.player.setEntityId(i); -@@ -2607,6 +3348,7 @@ +@@ -2607,6 +3349,7 @@ return theMinecraft == null || !theMinecraft.gameSettings.hideGUI; } @@ -1949,7 +1950,7 @@ public static boolean isFancyGraphicsEnabled() { return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics; -@@ -2623,8 +3365,16 @@ +@@ -2623,8 +3366,14 @@ /** * Called when user clicked he's mouse middle button (pick block) */ @@ -1957,17 +1958,15 @@ + public void middleClickMouse() //VIVECRAFT PUBLIC { + -+ if(Reflector.forgeExists()){ -+ if (Reflector.callBoolean(Reflector.ForgeHooks_onPickBlock, new Object[]{this.objectMouseOver,this.player,this.world})) -+ { -+ return; -+ } ++ if(Reflector.forgeExists() && this.objectMouseOver != null){ ++ Reflector.call(Reflector.ForgeHooks_onPickBlock, new Object[]{this.objectMouseOver,this.player,this.world}); ++ return; + } + if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) { boolean flag = this.player.capabilities.isCreativeMode; -@@ -2788,7 +3538,8 @@ +@@ -2788,7 +3537,8 @@ } } @@ -1977,7 +1976,7 @@ { NBTTagCompound nbttagcompound = te.writeToNBT(new NBTTagCompound()); -@@ -3098,6 +3849,11 @@ +@@ -3098,6 +3848,11 @@ */ public static int getGLMaximumTextureSize() { @@ -1989,7 +1988,7 @@ for (int i = 16384; i > 0; i >>= 1) { GlStateManager.glTexImage2D(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); -@@ -3264,7 +4020,7 @@ +@@ -3264,7 +4019,7 @@ } public void dispatchKeypresses() @@ -1998,7 +1997,7 @@ int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); if (i != 0 && !Keyboard.isRepeatEvent()) -@@ -3417,4 +4173,1209 @@ +@@ -3417,4 +4172,1209 @@ { return this.player != null && this.player.hasReducedDebug() || this.gameSettings.reducedDebugInfo; } diff --git a/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch index 59719a2..6d0fc6b 100644 --- a/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -576,7 +576,7 @@ vec3d2 = new Vec3d((double)(f2 * f5 - f3 * f4), vec3d2.yCoord, (double)(f3 * f5 + f2 * f4)); f1 = (float)vec3d2.lengthSquared(); -@@ -1269,4 +1483,338 @@ +@@ -1269,4 +1483,340 @@ } } } @@ -741,6 +741,7 @@ + if(this.capabilities.isFlying || this.inWater){ + switch (mc.vrSettings.vrFreeMoveMode){ + case VRSettings.FREEMOVE_CONTROLLER: ++ case VRSettings.FREEMOVE_JOYPAD: + directionVec= directionVec.rotatePitch(con.getControllerPitch_World(1) * PIOVER180); + break; + case VRSettings.FREEMOVE_HMD: @@ -758,6 +759,7 @@ + }else{ + switch (mc.vrSettings.vrFreeMoveMode){ + case VRSettings.FREEMOVE_CONTROLLER: ++ case VRSettings.FREEMOVE_JOYPAD: + directionVec=directionVec.rotateYaw(-con.getControllerYaw_World(1) * PIOVER180); + break; + case VRSettings.FREEMOVE_HMD: diff --git a/patches/net/minecraft/client/gui/GuiScreen.java.patch b/patches/net/minecraft/client/gui/GuiScreen.java.patch index dacdd95..d97ac78 100644 --- a/patches/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/net/minecraft/client/gui/GuiScreen.java.patch @@ -169,7 +169,7 @@ } /** -@@ -567,7 +617,22 @@ +@@ -567,7 +617,18 @@ { while (Mouse.next()) { @@ -185,14 +185,10 @@ this.handleMouseInput(); + if (Reflector.forgeExists() && this.equals(this.mc.currentScreen) && !this.mouseHandled) Reflector.postForgeBusEvent(Reflector.GuiScreenEvent_MouseInputEvent_Post_Constructor, this); + -+ if(mc.currentScreen == null){ -+ int a = 9; // wtf is this? -+ } -+ } } -@@ -575,7 +640,10 @@ +@@ -575,7 +636,10 @@ { while (Keyboard.next()) { @@ -203,7 +199,7 @@ } } } -@@ -589,6 +657,15 @@ +@@ -589,6 +653,15 @@ int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; int k = Mouse.getEventButton(); @@ -219,7 +215,7 @@ if (Mouse.getEventButtonState()) { if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0) -@@ -622,13 +699,20 @@ +@@ -622,13 +695,20 @@ */ public void handleKeyboardInput() throws IOException { @@ -241,7 +237,7 @@ this.mc.dispatchKeypresses(); } -@@ -652,13 +736,23 @@ +@@ -652,13 +732,23 @@ public void drawDefaultBackground() { this.drawWorldBackground(0); @@ -266,7 +262,7 @@ } else { -@@ -736,7 +830,7 @@ +@@ -736,7 +826,7 @@ */ public static boolean isShiftKeyDown() { @@ -275,7 +271,7 @@ } /** -@@ -774,4 +868,75 @@ +@@ -774,4 +864,75 @@ { this.setWorldAndResolution(mcIn, w, h); } diff --git a/patches/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/net/minecraft/client/renderer/EntityRenderer.java.patch index 2f75c68..341adbe 100644 --- a/patches/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1176,7 +1176,7 @@ this.mc.getTextureManager().bindTexture(this.locationLightMap); GlStateManager.glTexParameteri(3553, 10241, 9729); GlStateManager.glTexParameteri(3553, 10240, 9729); -@@ -1220,708 +1313,819 @@ +@@ -1220,708 +1313,820 @@ } } @@ -2395,11 +2395,12 @@ + { + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); -+ ++ + if (!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] {renderglobal, entityplayer, this.mc.objectMouseOver, Integer.valueOf(0), Float.valueOf(partialTicks)})) + { + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + } ++ + GlStateManager.enableAlpha(); + } + @@ -2639,7 +2640,7 @@ private void addRainParticles() { float f = this.mc.world.getRainStrength(1.0F); -@@ -2013,7 +2217,7 @@ +@@ -2013,7 +2218,7 @@ if (Reflector.ForgeWorldProvider_getWeatherRenderer.exists()) { WorldProvider worldprovider = this.mc.world.provider; @@ -2648,7 +2649,7 @@ if (object != null) { -@@ -2216,7 +2420,7 @@ +@@ -2216,7 +2421,7 @@ double d0 = MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) > 0.0F ? -1.0D : 1.0D; Vec3d vec3d2 = new Vec3d(d0, 0.0D, 0.0D); float f5 = (float)entity.getLook(partialTicks).dotProduct(vec3d2); @@ -2657,7 +2658,7 @@ if (f5 < 0.0F) { f5 = 0.0F; -@@ -2260,8 +2464,12 @@ +@@ -2260,8 +2465,12 @@ this.fogColorBlue *= f11; } @@ -2672,7 +2673,7 @@ if (this.cloudFog) { Vec3d vec3d3 = world.getCloudColour(partialTicks); -@@ -2269,7 +2477,7 @@ +@@ -2269,7 +2478,7 @@ this.fogColorGreen = (float)vec3d3.yCoord; this.fogColorBlue = (float)vec3d3.zCoord; } @@ -2681,7 +2682,7 @@ { float f12 = 0.0F; -@@ -2295,7 +2503,7 @@ +@@ -2295,7 +2504,7 @@ this.fogColorBlue = (float)vec3d4.zCoord; } } @@ -2690,7 +2691,7 @@ { this.fogColorRed = 0.6F; this.fogColorGreen = 0.1F; -@@ -2373,16 +2581,14 @@ +@@ -2373,16 +2582,14 @@ this.fogColorBlue = f7; } @@ -2714,7 +2715,7 @@ } /** -@@ -2396,7 +2602,13 @@ +@@ -2396,7 +2603,13 @@ GlStateManager.glFog(2918, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); GlStateManager.glNormal3f(0.0F, -1.0F, 0.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -2729,7 +2730,7 @@ float f = -1.0F; if (Reflector.ForgeHooksClient_getFogDensity.exists()) -@@ -2456,7 +2668,7 @@ +@@ -2456,7 +2669,7 @@ GlStateManager.setFogDensity(0.1F); } @@ -2738,7 +2739,7 @@ { if (Config.isShaders()) { -@@ -2488,7 +2700,7 @@ +@@ -2488,7 +2701,7 @@ GlStateManager.setFogDensity(0.02F); } } @@ -2747,7 +2748,7 @@ { if (Config.isShaders()) { -@@ -2550,12 +2762,24 @@ +@@ -2550,12 +2763,24 @@ Reflector.callVoid(Reflector.ForgeHooksClient_onFogRender, new Object[] {this, entity, iblockstate, Float.valueOf(partialTicks), Integer.valueOf(startCoords), Float.valueOf(f1)}); } } @@ -2773,7 +2774,7 @@ /** * Update and return fogColorBuffer with the RGBA values passed as arguments */ -@@ -2572,6 +2796,12 @@ +@@ -2572,6 +2797,12 @@ return this.fogColorBuffer; } @@ -2786,7 +2787,7 @@ public MapItemRenderer getMapItemRenderer() { return this.theMapItemRenderer; -@@ -2716,10 +2946,12 @@ +@@ -2716,10 +2947,12 @@ this.updatedWorld = world; } @@ -2803,7 +2804,7 @@ } private void frameFinish() -@@ -2743,39 +2975,6 @@ +@@ -2743,39 +2976,6 @@ } } @@ -2843,7 +2844,7 @@ public boolean setFxaaShader(int p_setFxaaShader_1_) { if (!OpenGlHelper.isFramebufferEnabled()) -@@ -2815,75 +3014,6 @@ +@@ -2815,75 +3015,6 @@ } } @@ -2919,7 +2920,7 @@ public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking) { GlStateManager.pushMatrix(); -@@ -2927,4 +3057,2340 @@ +@@ -2927,4 +3058,2340 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } diff --git a/patches/net/minecraft/entity/projectile/EntityThrowable.java.patch b/patches/net/minecraft/entity/projectile/EntityThrowable.java.patch index 899ca31..1814a49 100644 --- a/patches/net/minecraft/entity/projectile/EntityThrowable.java.patch +++ b/patches/net/minecraft/entity/projectile/EntityThrowable.java.patch @@ -15,31 +15,24 @@ import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.datafix.DataFixer; -@@ -50,12 +52,22 @@ - public EntityThrowable(World worldIn, double x, double y, double z) +@@ -56,7 +58,16 @@ + public EntityThrowable(World worldIn, EntityLivingBase throwerIn) { - this(worldIn); -- this.setPosition(x, y, z); + this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ); ++ + this.thrower = throwerIn; + + //VIVE SET SPAWNPOS + if (this.thrower.getEntityId() == Minecraft.getMinecraft().player.getEntityId()) + { + Vec3d aimSource = Minecraft.getMinecraft().roomScale.getControllerPos_World(0); + this.setPosition(aimSource.xCoord, aimSource.yCoord, aimSource.zCoord); -+ } else -+ this.setPosition(x, y, z); ++ } + /// } - public EntityThrowable(World worldIn, EntityLivingBase throwerIn) - { - this(worldIn, throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight() - 0.10000000149011612D, throwerIn.posZ); -+ -+ - this.thrower = throwerIn; - } - -@@ -84,6 +96,14 @@ + protected void entityInit() +@@ -84,6 +95,14 @@ */ public void setHeadingFromThrower(Entity entityThrower, float rotationPitchIn, float rotationYawIn, float pitchOffset, float velocity, float inaccuracy) { @@ -54,7 +47,7 @@ float f = -MathHelper.sin(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); float f1 = -MathHelper.sin((rotationPitchIn + pitchOffset) * 0.017453292F); float f2 = MathHelper.cos(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); -@@ -259,7 +279,8 @@ +@@ -259,7 +278,8 @@ } else { diff --git a/patches/net/minecraft/util/MovementInputFromOptions.java.patch b/patches/net/minecraft/util/MovementInputFromOptions.java.patch index 83a946d..23cb0a9 100644 --- a/patches/net/minecraft/util/MovementInputFromOptions.java.patch +++ b/patches/net/minecraft/util/MovementInputFromOptions.java.patch @@ -1,15 +1,17 @@ --- a/net/minecraft/util/MovementInputFromOptions.java +++ b/net/minecraft/util/MovementInputFromOptions.java -@@ -1,5 +1,8 @@ +@@ -1,5 +1,10 @@ package net.minecraft.util; ++import com.mtbs3d.minecrift.control.VRControllerButtonMapping; ++import com.mtbs3d.minecrift.provider.MCOpenVR; +import com.mtbs3d.minecrift.settings.VRSettings; + +import net.minecraft.client.Minecraft; import net.minecraft.client.settings.GameSettings; public class MovementInputFromOptions extends MovementInput -@@ -15,8 +18,15 @@ +@@ -15,8 +20,15 @@ { this.moveStrafe = 0.0F; this.moveForward = 0.0F; @@ -27,12 +29,28 @@ { ++this.moveForward; this.forwardKeyDown = true; -@@ -56,13 +66,28 @@ +@@ -56,13 +68,44 @@ this.rightKeyDown = false; } - this.jump = this.gameSettings.keyBindJump.isKeyDown(); - this.sneak = this.gameSettings.keyBindSneak.isKeyDown(); ++ if(mc.vrSettings.vrFreeMoveMode == mc.vrSettings.FREEMOVE_JOYPAD){ ++ //override everything ++ this.moveForward = MCOpenVR.joyPadZ; ++ this.moveStrafe = MCOpenVR.joyPadX; ++ ++ //just assuming all this below is needed for compatibility. ++ this.forwardKeyDown = this.moveForward > 0; ++ this.backKeyDown = this.moveForward < 0; ++ this.leftKeyDown = this.moveStrafe < 0 ; ++ this.rightKeyDown = this.moveStrafe > 0; ++ VRControllerButtonMapping.setKeyBindState(this.gameSettings.keyBindForward, this.forwardKeyDown); ++ VRControllerButtonMapping.setKeyBindState(this.gameSettings.keyBindBack, this.backKeyDown); ++ VRControllerButtonMapping.setKeyBindState(this.gameSettings.keyBindLeft, this.leftKeyDown); ++ VRControllerButtonMapping.setKeyBindState(this.gameSettings.keyBindRight, this.rightKeyDown); ++ } ++ + + boolean ok = mc.currentScreen==null && (mc.vrPlayer.getFreeMove() || mc.vrSettings.simulateFalling); + diff --git a/src/com/mtbs3d/minecrift/gui/GuiKeyBindingSelection.java b/src/com/mtbs3d/minecrift/gui/GuiKeyBindingSelection.java new file mode 100644 index 0000000..0399301 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gui/GuiKeyBindingSelection.java @@ -0,0 +1,179 @@ +package com.mtbs3d.minecrift.gui; + +import java.util.Arrays; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiListExtended; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.text.TextFormatting; +import org.apache.commons.lang3.ArrayUtils; + +public class GuiKeyBindingSelection extends GuiListExtended +{ + private final GuiVRControls controlsScreen; + private final Minecraft mc; + private final GuiListExtended.IGuiListEntry[] listEntries; + private int maxListLabelWidth; + + public GuiKeyBindingSelection(GuiVRControls controls, Minecraft mcIn) + { + super(mcIn, controls.width + 45, controls.height, 63, controls.height - 32, 20); + this.controlsScreen = controls; + this.mc = mcIn; + KeyBinding[] akeybinding = (KeyBinding[])ArrayUtils.clone(mcIn.gameSettings.keyBindings); + this.listEntries = new GuiListExtended.IGuiListEntry[akeybinding.length + KeyBinding.getKeybinds().size()+7]; + Arrays.sort((Object[])akeybinding); + int i = 0; + String s = null; + + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry("None"); + + for (KeyBinding keybinding : akeybinding) + { + String s1 = keybinding.getKeyCategory(); + + if (!s1.equals(s)) + { + s = s1; + this.listEntries[i++] = new GuiKeyBindingSelection.CategoryEntry(s1); + } + + int j = mcIn.fontRendererObj.getStringWidth(I18n.format(keybinding.getKeyDescription())); + + if (j > this.maxListLabelWidth) + { + this.maxListLabelWidth = j; + } + + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry(keybinding); + } + this.listEntries[i++] = new GuiKeyBindingSelection.CategoryEntry("Keyboard Emulation"); + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry("keyboard (press)"); + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry("keyboard (hold)"); + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry("keyboard-shift"); + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry("keyboard-ctrl"); + this.listEntries[i++] = new GuiKeyBindingSelection.KeyEntry("keyboard-alt"); + + } + + protected int getSize() + { + return this.listEntries.length; + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public GuiListExtended.IGuiListEntry getListEntry(int index) + { + return this.listEntries[index]; + } + + protected int getScrollBarX() + { + return super.getScrollBarX() + 15; + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return super.getListWidth() + 32; + } + + public class CategoryEntry implements GuiListExtended.IGuiListEntry + { + private final String labelText; + private final int labelWidth; + + public CategoryEntry(String name) + { + this.labelText = I18n.format(name); + this.labelWidth = GuiKeyBindingSelection.this.mc.fontRendererObj.getStringWidth(this.labelText); + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) { + GuiKeyBindingSelection.this.mc.fontRendererObj.drawString(TextFormatting.AQUA + this.labelText, GuiKeyBindingSelection.this.mc.currentScreen.width / 2 - this.labelWidth / 2, y + slotHeight - GuiKeyBindingSelection.this.mc.fontRendererObj.FONT_HEIGHT - 1, 16777215); + } + + public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY) + { + return false; + } + + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } + + public void updatePosition(int p_192633_1_, int p_192633_2_, int p_192633_3_, float p_192633_4_) + { + } + + @Override + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) { + // TODO Auto-generated method stub + + } + + } + + public class KeyEntry implements GuiListExtended.IGuiListEntry + { + private final String keyDesc; + private final String keyPrettyDesc; + + private KeyEntry(String keydesc) + { + this.keyDesc = keydesc; + this.keyPrettyDesc= I18n.format(keydesc); + } + + + public KeyEntry(KeyBinding keybinding) { + this.keyDesc = keybinding.getKeyDescription(); + this.keyPrettyDesc= I18n.format(this.keyDesc); + } + + + @Override + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, + boolean isSelected) { + boolean flag = (mouseX <= GuiKeyBindingSelection.this.width * .6) && mouseY < y + slotHeight && mouseY > y; + if(flag) + GuiKeyBindingSelection.this.mc.fontRendererObj.drawString(TextFormatting.GREEN + this.keyPrettyDesc, x + 190 - GuiKeyBindingSelection.this.maxListLabelWidth, y + slotHeight / 2 - GuiKeyBindingSelection.this.mc.fontRendererObj.FONT_HEIGHT / 2, 16777215); + else + GuiKeyBindingSelection.this.mc.fontRendererObj.drawString(TextFormatting.WHITE + this.keyPrettyDesc, x + 190 - GuiKeyBindingSelection.this.maxListLabelWidth, y + slotHeight / 2 - GuiKeyBindingSelection.this.mc.fontRendererObj.FONT_HEIGHT / 2, 16777215); + + } + + public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY) + { + if(mouseX > GuiKeyBindingSelection.this.width * .6) return false; + if(GuiKeyBindingSelection.this.controlsScreen.buttonId == null) return false; //how did u get here? + GuiKeyBindingSelection.this.controlsScreen.selectionMode = false; + GuiKeyBindingSelection.this.controlsScreen.buttonId.FunctionDesc = this.keyDesc; + GuiKeyBindingSelection.this.controlsScreen.bindKey(GuiKeyBindingSelection.this.controlsScreen.buttonId); + if(this.keyDesc.startsWith("keyboard")) GuiKeyBindingSelection.this.controlsScreen.waitingForKey = true; + return true; + } + + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } + + public void updatePosition(int p_192633_1_, int p_192633_2_, int p_192633_3_, float p_192633_4_) + { + } + + + @Override + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) { + // TODO Auto-generated method stub + + } + + } +} diff --git a/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java b/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java index 5af1735..83d1115 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java @@ -347,7 +347,9 @@ protected String[] getTooltipLines(String displayString, int buttonId) "Controller: Uses left controller direction, max speed", "HMD: Uses head direction, max speed", "Run In Place: Use average controllers direction. Speed based", - "on controller motion." + "on controller motion.", + "Joy/Pad: Uses the left touchpad or joystick for all motion.", + "Overrides all 4 movement direction keybinds." } ; case VEHICLE_ROTATION: diff --git a/src/com/mtbs3d/minecrift/gui/GuiVRControls.java b/src/com/mtbs3d/minecrift/gui/GuiVRControls.java index b287866..b297532 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiVRControls.java +++ b/src/com/mtbs3d/minecrift/gui/GuiVRControls.java @@ -16,16 +16,24 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.resources.I18n; import net.minecraft.client.settings.KeyBinding; public class GuiVRControls extends BaseGuiSettings { - private GuiVRControlsList guiList; public VRControllerButtonMapping buttonId; - + public boolean selectionMode = false; + public boolean waitingForKey; + + private GuiVRControlsList guiList; + private GuiKeyBindingSelection guiSelection; + private GuiButton btnDefaults; + private GuiButton btnDone; + private GuiButton btnCancel; + public GuiVRControls(GuiScreen par1GuiScreen, VRSettings par2vrSettings) { super(par1GuiScreen, par2vrSettings); - screenTitle = "Control Remapping"; + screenTitle = "VR Control Remapping"; } /** @@ -34,44 +42,96 @@ public GuiVRControls(GuiScreen par1GuiScreen, VRSettings par2vrSettings) { */ protected void keyTyped(char typedChar, int keyCode) { - if (this.buttonId != null) + if (waitingForKey) { buttonId.FunctionExt = typedChar; - this.buttonId = null; + waitingForKey = false; } else { try { super.keyTyped(typedChar, keyCode); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } } + + /** * Adds the buttons (and other controls) to the screen in question. */ public void initGui() { this.guiList = new GuiVRControlsList(this, mc); + this.guiSelection = new GuiKeyBindingSelection(this, mc); this.buttonList.clear(); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); + btnDefaults = (new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + btnDone = (new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); + btnCancel = (new GuiButtonEx(99, this.width / 2 - 155 + 80, this.height -25,150,20, "Cancel")); + btnCancel.visible = false; + this.buttonList.add(btnDefaults); + this.buttonList.add(btnDone); + this.buttonList.add(btnCancel); } /** * Draws the screen and all the components in it. */ public void drawScreen(int par1, int par2, float par3) { - if (reinit) { - initGui(); - reinit = false; - } - this.guiList.drawScreen(par1, par2, par3); - super.drawScreen(par1,par2,par3,false); - } + if (reinit) { + initGui(); + reinit = false; + } + + if(waitingForKey){ + screenTitle = "Press Keyboard Key..."; + btnCancel.visible = true; + btnDone.visible = false; + btnDefaults.visible = false; + }else { + if(this.selectionMode && this.buttonId != null){ + btnCancel.visible = true; + btnDone.visible = false; + btnDefaults.visible = false; + screenTitle = "Choose action for " + this.buttonId.Button.toString() + " (Current: " + I18n.format(this.buttonId.FunctionDesc)+")"; + this.guiSelection.drawScreen(par1, par2, par3); + } + else{ + btnCancel.visible = false; + btnDone.visible = true; + btnDefaults.visible = true; + this.selectionMode = false; + screenTitle = "VR Control Remapping"; + this.guiList.drawScreen(par1, par2, par3); + } + } + super.drawScreen(par1,par2,par3,false); + } + + public void bindKey(VRControllerButtonMapping key){ + if(key.FunctionDesc.equals("None")){ + key.key = null; + key.FunctionExt = 0; + return; + } + if(key.FunctionDesc.startsWith("keyboard")){ + key.key = null; + if(key.FunctionDesc.contains("-")) key.FunctionExt = 0; + return; + } + KeyBinding[] var3 = mc.gameSettings.keyBindings; + for (final KeyBinding keyBinding : var3) { + if (keyBinding.getKeyDescription().equals(key.FunctionDesc)){ + key.key = keyBinding; + key.FunctionExt = 0; + return; + } + } + System.out.println("Keybind not found for " + key.FunctionDesc); + } + /** * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). */ @@ -82,6 +142,9 @@ protected void actionPerformed(GuiButton par1GuiButton) { } else if (par1GuiButton.id == ID_GENERIC_DEFAULTS){ mc.vrSettings.resetBindings(); this.initGui(); + } else if (par1GuiButton.id == 99){ //selection cancel + this.selectionMode = false; + this.waitingForKey = false; } } @@ -90,13 +153,21 @@ protected void actionPerformed(GuiButton par1GuiButton) { */ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { - this.buttonId = null; - if (mouseButton != 0 || !this.guiList.mouseClicked(mouseX, mouseY, mouseButton)) + + boolean flag = false; + + if(this.selectionMode){ + flag = this.guiSelection.mouseClicked(mouseX, mouseY, mouseButton); + this.guiList.setEnabled(true); + }else{ + flag = this.guiList.mouseClicked(mouseX, mouseY, mouseButton); + this.guiSelection.setEnabled(true); + } + if (!flag) { try { super.mouseClicked(mouseX, mouseY, mouseButton); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } diff --git a/src/com/mtbs3d/minecrift/gui/GuiVRControlsList.java b/src/com/mtbs3d/minecrift/gui/GuiVRControlsList.java index 6780da5..77fe127 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiVRControlsList.java +++ b/src/com/mtbs3d/minecrift/gui/GuiVRControlsList.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.Arrays; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiListExtended; @@ -15,7 +14,6 @@ import net.minecraft.util.text.TextFormatting; import org.apache.commons.lang3.ArrayUtils; -import org.lwjgl.input.Keyboard; import com.mtbs3d.minecrift.control.VRControllerButtonMapping; import com.mtbs3d.minecrift.control.ViveButtons; @@ -29,46 +27,6 @@ public class GuiVRControlsList extends GuiListExtended private final GuiListExtended.IGuiListEntry[] listEntries; private int maxListLabelWidth = 0; private static final String __OBFID = "CL_00000732"; - - public ArrayList getPossibleFunctions(){ - ArrayList out = new ArrayList(); - - out.add("none"); - - for (KeyBinding key : mc.gameSettings.keyBindings) { - out.add(key.getKeyDescription()); - } - - out.add("keyboard(press)"); - out.add("keyboard(hold)"); - out.add("keyboard-shift"); - out.add("keyboard-ctrl"); - out.add("keyboard-alt"); - - return out; - } - - public void bindKey(VRControllerButtonMapping key){ - if(key.FunctionDesc.equals("none")){ - key.key = null; - key.FunctionExt = 0; - return; - } - if(key.FunctionDesc.startsWith("keyboard")){ - key.key = null; - if(key.FunctionDesc.contains("-")) key.FunctionExt = 0; - return; - } - KeyBinding[] var3 = mc.gameSettings.keyBindings; - for (final KeyBinding keyBinding : var3) { - if (keyBinding.getKeyDescription().equals(key.FunctionDesc)){ - key.key = keyBinding; - key.FunctionExt = 0; - return; - } - } - System.out.println("Keybind not found for " + key.FunctionDesc); - } public GuiVRControlsList(GuiVRControls parent, Minecraft mc) { @@ -84,20 +42,13 @@ public GuiVRControlsList(GuiVRControls parent, Minecraft mc) this.listEntries = new GuiListExtended.IGuiListEntry[bindings.size()]; - // Arrays.sort(bindings); String var5 = null; int var4 = 0; int var7 = bindings.size(); for (int i = 0; i < var7; i++) { VRControllerButtonMapping kb = bindings.get(i); - String cat = "VR"; // kb.getKeyCategory(); - - if (!cat.equals(var5)) - { - var5 = cat; - // this.listEntries[var4++] = new GuiVRControlsList.CategoryEntry(cat); - } + String cat = "VR"; int width = mc.fontRendererObj.getStringWidth(I18n.format(kb.FunctionDesc, new Object[0])); @@ -151,7 +102,7 @@ public CategoryEntry(String p_i45028_2_) @Override public void drawEntry(int p_148279_1_, int p_148279_2_, int p_148279_3_, int p_148279_4_, int p_148279_5_, int p_148279_7_, int p_148279_8_, boolean p_148279_9_) { - GuiVRControlsList.this.mc.fontRendererObj.drawString(this.labelText, GuiVRControlsList.this.mc.currentScreen.width / 2 - this.labelWidth / 2, p_148279_3_ + p_148279_5_ - GuiVRControlsList.this.mc.fontRendererObj.FONT_HEIGHT - 1, 16777215); + mc.fontRendererObj.drawString(this.labelText, GuiVRControlsList.this.mc.currentScreen.width / 2 - this.labelWidth / 2, p_148279_3_ + p_148279_5_ - GuiVRControlsList.this.mc.fontRendererObj.FONT_HEIGHT - 1, 16777215); } public boolean mousePressed(int p_148278_1_, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) @@ -159,35 +110,30 @@ public boolean mousePressed(int p_148278_1_, int p_148278_2_, int p_148278_3_, i return false; } - public void mouseReleased(int p_148277_1_, int p_148277_2_, int p_148277_3_, int p_148277_4_, int p_148277_5_, int p_148277_6_) {} - - + public void mouseReleased(int p_148277_1_, int p_148277_2_, int p_148277_3_, int p_148277_4_, int p_148277_5_, int p_148277_6_) + { + } @Override public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) { // TODO Auto-generated method stub } - } public class MappingEntry implements GuiListExtended.IGuiListEntry { private final VRControllerButtonMapping myKey; private final GuiButton btnChangeKeyBinding; - private final GuiButton btnKey; - private final ArrayList possibilites; - private int myi; private static final String __OBFID = "CL_00000735"; private GuiEnterText guiEnterText; + private GuiVRControls parentScreen; - private MappingEntry(VRControllerButtonMapping key) + private MappingEntry(VRControllerButtonMapping key, GuiVRControls parent) { this.myKey = key; this.btnChangeKeyBinding = new GuiButton(0, 0, 0, 150, 18, I18n.format(key.FunctionDesc, new Object[0])); - this.possibilites = GuiVRControlsList.this.getPossibleFunctions(); - myi = this.possibilites.indexOf(myKey.FunctionDesc); - btnKey =new GuiButton(0, 0, 0, 18, 18, ""); + this.parentScreen = parent; } @Override @@ -196,49 +142,20 @@ public void drawEntry(int p_148279_1_, int x, int y, int p_148279_4_, int p_1482 GuiVRControlsList.this.mc.fontRendererObj.drawString(myKey.Button.toString().replace("BUTTON_", "").replace("OCULUS_", ""), x + 40 - GuiVRControlsList.this.maxListLabelWidth, y + p_148279_5_ / 2 - GuiVRControlsList.this.mc.fontRendererObj.FONT_HEIGHT / 2, 16777215); this.btnChangeKeyBinding.xPosition = x + 90; - this.btnChangeKeyBinding.yPosition = y; - this.btnChangeKeyBinding.displayString = I18n.format(this.myKey.FunctionDesc, new Object[0]); + this.btnChangeKeyBinding.yPosition= y; + this.btnChangeKeyBinding.displayString = I18n.format(this.myKey.FunctionDesc, new Object[0]) + " " + this.myKey.FunctionExt; - this.btnKey.xPosition = x+240; - this.btnKey.yPosition = y; - this.btnKey.visible = (myKey.FunctionDesc.startsWith("keyboard(")); - this.btnKey.displayString = String.valueOf((myKey.FunctionExt)); - boolean var10 = GuiVRControlsList.this.parent.buttonId == myKey; - - if (var10) - { - this.btnKey.displayString = TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.btnKey.displayString + TextFormatting.WHITE + " <"; - } - else if (false) - { //alow multi binding. - this.btnKey.displayString = TextFormatting.RED + this.btnKey.displayString; - } - this.btnChangeKeyBinding.drawButton(GuiVRControlsList.this.mc, p_148279_7_, p_148279_8_); - this.btnKey.drawButton(GuiVRControlsList.this.mc, p_148279_7_, p_148279_8_); } public boolean mousePressed(int p_148278_1_, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) { - if (this.btnChangeKeyBinding.mousePressed(GuiVRControlsList.this.mc, p_148278_2_, p_148278_3_)) - { - //cycle? select from list? - if (GuiScreen.isShiftKeyDown()) myi--; - else myi++; - if(myi >= possibilites.size()) myi = 0; - if(myi < 0) myi = possibilites.size() - 1; - this.myKey.FunctionDesc = possibilites.get(myi); - bindKey(myKey); - - return true; - } - else if (this.btnKey.mousePressed(GuiVRControlsList.this.mc, p_148278_2_, p_148278_3_)) - { - GuiVRControlsList.this.parent.buttonId = myKey; - - return true; + { + parent.selectionMode = true; + parent.buttonId = myKey; + return true; } else { @@ -249,15 +166,8 @@ else if (this.btnKey.mousePressed(GuiVRControlsList.this.mc, p_148278_2_, p_1482 public void mouseReleased(int p_148277_1_, int p_148277_2_, int p_148277_3_, int p_148277_4_, int p_148277_5_, int p_148277_6_) { this.btnChangeKeyBinding.mouseReleased(p_148277_2_, p_148277_3_); - // this.btnReset.mouseReleased(p_148277_2_, p_148277_3_); - } - - MappingEntry(VRControllerButtonMapping p_i45030_2_, Object p_i45030_3_) - { - this(p_i45030_2_); } - @Override public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) { // TODO Auto-generated method stub @@ -265,5 +175,6 @@ public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) { } + } } diff --git a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java index 26f92e6..b4b0fa6 100644 --- a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java +++ b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java @@ -1151,7 +1151,8 @@ private static void updateControllerButtonState() } } } - + + public static float joyPadX, joyPadZ; //OK the fundamental problem with this is Minecraft uses a LWJGL event buffer for keyboard and mouse inputs. It polls those devices faster //and presents the game with a nice queue of things that happened. With OpenVR we're polling the controllers directly on the -game- (edit render?) loop. @@ -1274,24 +1275,38 @@ private static void processControllerButtons(boolean sleeping, boolean gui) boolean lastpressedLTrigger = lastControllerState[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold; boolean lastpressedLTriggerClick = lastControllerState[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > 0.99F; //current + + float LTouchPadX = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x; + float LTouchPadY = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y; + boolean pressedLGrip = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonGrip) > 0; boolean pressedLtouchpadBottomLeft = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonTouchpad) > 0 && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y < 0 ) && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x < 0 ) ; + (LTouchPadY< 0 ) && + (LTouchPadX < 0 ) ; boolean pressedLtouchpadBottomRight = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonTouchpad) > 0 && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y < 0 ) && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x > 0 ) ; + (LTouchPadY < 0 ) && + (LTouchPadX > 0 ) ; boolean pressedLtouchpadTopLeft = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonTouchpad) > 0 && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y > 0 ) && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x < 0 ) ; + (LTouchPadY> 0 ) && + (LTouchPadX < 0 ) ; boolean pressedLtouchpadTopRight = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonTouchpad) > 0 && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y > 0 ) && - (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x > 0 ) ; + (LTouchPadY > 0 ) && + (LTouchPadX> 0 ) ; boolean pressedLAppMenu = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonAppMenu) > 0; boolean pressedLTrigger = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold; boolean pressedLTriggerClick = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > 0.99F; - + + boolean TouchingLPad = (controllerStateReference[LEFT_CONTROLLER].ulButtonTouched & k_buttonTouchpad) > 0; + + if(TouchingLPad){ + joyPadX = -LTouchPadX; + joyPadZ = LTouchPadY; + } else { + joyPadX = 0; + joyPadZ = 0; + } + if(!gui){ //l GRIP - no gui cause shift. if (pressedLGrip && !lastpressedLGrip) { @@ -1384,7 +1399,7 @@ private static void processControllerButtons(boolean sleeping, boolean gui) if(pressedRAppMenu && !lastpressedRAppMenu) { if(mc.gameSettings.keyBindPickBlock.isKeyDown() && mc.vrSettings.displayMirrorMode == mc.vrSettings.MIRROR_MIXED_REALITY){ - VRHotkeys.snapMRCam(mc,0); + if(!Main.kiosk)VRHotkeys.snapMRCam(mc,0); mc.vrSettings.saveOptions(); } } @@ -1595,7 +1610,8 @@ private static void processControllerButtonsOculus(boolean sleeping, boolean gui boolean pressedStickDown = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y < -0.5 ; boolean pressedStickUp = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y > 0.5 ; - + joyPadX = -controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x; + joyPadZ = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y; rtbX = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x; rtbY = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].y; @@ -1645,24 +1661,27 @@ private static void processControllerButtonsOculus(boolean sleeping, boolean gui if (TouchedLStick && !lastTouchedLStick) { mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_TOUCH.ordinal()].press(); } - //L Stick Left - if (pressedStickLeft && !lastpressedStickLeft) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_LEFT.ordinal()].press(); - } - //L Stick Right - if (pressedStickRight && !lastpressedStickRight) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_RIGHT.ordinal()].press(); - } - //L Stick Up - if (pressedStickUp && !lastpressedStickUp) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_UP.ordinal()].press(); - } - //L Stick Down - if (pressedStickDown && !lastpressedStickDown) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_DOWN.ordinal()].press(); + + if(mc.vrSettings.vrFreeMoveMode != mc.vrSettings.FREEMOVE_JOYPAD){ + //L Stick Left + if (pressedStickLeft && !lastpressedStickLeft) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_LEFT.ordinal()].press(); + } + //L Stick Right + if (pressedStickRight && !lastpressedStickRight) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_RIGHT.ordinal()].press(); + } + //L Stick Up + if (pressedStickUp && !lastpressedStickUp) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_UP.ordinal()].press(); + } + //L Stick Down + if (pressedStickDown && !lastpressedStickDown) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_DOWN.ordinal()].press(); + } } + //unpress - //L GRIP if (!pressedLHandTrigger && lastpressedLHandTrigger) { mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_HAND_TRIGGER_PRESS.ordinal()].unpress(); @@ -1703,24 +1722,26 @@ private static void processControllerButtonsOculus(boolean sleeping, boolean gui if (!TouchedLStick && lastTouchedLStick) { mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_TOUCH.ordinal()].unpress(); } - //L Stick Left - if (!pressedStickLeft && lastpressedStickLeft) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_LEFT.ordinal()].unpress(); - } - //L Stick Right - if (!pressedStickRight && lastpressedStickRight) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_RIGHT.ordinal()].unpress(); - } - //L Stick Up - if (!pressedStickUp && lastpressedStickUp) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_UP.ordinal()].unpress(); - } - //L Stick Down - if (!pressedStickDown && lastpressedStickDown) { - mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_DOWN.ordinal()].unpress(); + + if(mc.vrSettings.vrFreeMoveMode != mc.vrSettings.FREEMOVE_JOYPAD){ + //L Stick Left + if (!pressedStickLeft && lastpressedStickLeft) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_LEFT.ordinal()].unpress(); + } + //L Stick Right + if (!pressedStickRight && lastpressedStickRight) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_RIGHT.ordinal()].unpress(); + } + //L Stick Up + if (!pressedStickUp && lastpressedStickUp) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_UP.ordinal()].unpress(); + } + //L Stick Down + if (!pressedStickDown && lastpressedStickDown) { + mc.vrSettings.buttonMappings[ViveButtons.OCULUS_LEFT_STICK_DOWN.ordinal()].unpress(); + } } - if(pressedY && !lastpressedY) { //handle menu directly if(pressedLHandTrigger){ setKeyboardOverlayShowing(!keyboardShowing, null); @@ -1730,41 +1751,30 @@ private static void processControllerButtonsOculus(boolean sleeping, boolean gui mc.getConnection().sendPacket(new CPacketClientStatus(State.PERFORM_RESPAWN)); mc.displayGuiScreen((GuiScreen)null); }else { - - if(Display.isActive()) - KeyboardSimulator.robot.keyPress(KeyEvent.VK_ESCAPE); //window focus... yadda yadda - else - mc.player.closeScreen(); - + mc.player.closeScreen(); setKeyboardOverlayShowing(false, null); } - }else{ - if(!Main.kiosk){ - if(Display.isActive()) - KeyboardSimulator.robot.keyPress(KeyEvent.VK_ESCAPE); //window focus... yadda yadda - else - mc.displayInGameMenu(); - } - setKeyboardOverlayShowing(false, null); - } + }else + + if(!Main.kiosk)mc.displayInGameMenu(); } } if(pressedA && !lastpressedA) { //handle menu directly if(mc.gameSettings.keyBindPickBlock.isKeyDown() && mc.vrSettings.displayMirrorMode == mc.vrSettings.MIRROR_MIXED_REALITY){ - VRHotkeys.snapMRCam(mc,0); + if(!Main.kiosk)VRHotkeys.snapMRCam(mc,0); mc.vrSettings.saveOptions(); } } if (mc.currentScreen != null) { if(pressedRStickUp && !lastpressedRStickUp){ - KeyboardSimulator.robot.mouseWheel(-25); + KeyboardSimulator.robot.mouseWheel(-120); MCOpenVR.triggerHapticPulse(0, 100); } if(pressedRStickDown && !lastpressedRStickDown){ - KeyboardSimulator.robot.mouseWheel(25); + KeyboardSimulator.robot.mouseWheel(120); MCOpenVR.triggerHapticPulse(0, 100); } } @@ -2003,6 +2013,7 @@ private static void clearTouchpadSampleBuffer(int controller) private static void processTouchpadSampleBuffer() { for(int c=0;c<2;c++){ + if(c==1 && mc.vrSettings.vrFreeMoveMode == mc.vrSettings.FREEMOVE_JOYPAD) continue; boolean touchpadPressed = (controllerStateReference[c].ulButtonPressed & k_buttonTouchpad) > 0; if (touchpadSampleCount[c] > 5 && !touchpadPressed){ int sample = touchpadSampleCount[c] - 5; diff --git a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java index b90aae5..c543924 100644 --- a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java +++ b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java @@ -263,8 +263,7 @@ public void onLivingUpdate(EntityPlayerSP player, Minecraft mc, Random rand) // don't do teleport movement if on a server that doesn't have this mod installed if (getFreeMove()) { - if(player.movementInput.moveForward ==0) doPlayerMoveInRoom(player); - + if(player.movementInput.moveForward ==0 && player.movementInput.moveStrafe == 0) doPlayerMoveInRoom(player); return; //let mc handle look direction movement // controller vs gaze movement is handled in Entity.java > moveFlying } @@ -276,8 +275,7 @@ public void onLivingUpdate(EntityPlayerSP player, Minecraft mc, Random rand) boolean doTeleport = false; Vec3d dest = null; - if (player.movementInput.moveForward != 0 && !player.isRiding()) //holding down Ltrigger - { + if ((player.movementInput.moveForward != 0 || player.movementInput.moveStrafe != 0) && !player.isRiding()){ //holding down Ltrigger { dest = movementTeleportDestination; if (vrMovementStyle.teleportOnRelease) diff --git a/src/com/mtbs3d/minecrift/settings/VRSettings.java b/src/com/mtbs3d/minecrift/settings/VRSettings.java index 247966a..0cb2498 100644 --- a/src/com/mtbs3d/minecrift/settings/VRSettings.java +++ b/src/com/mtbs3d/minecrift/settings/VRSettings.java @@ -75,6 +75,7 @@ public class VRSettings public static final int FREEMOVE_CONTROLLER= 1; public static final int FREEMOVE_HMD= 2; public static final int FREEMOVE_RUNINPLACE= 3; + public static final int FREEMOVE_JOYPAD = 4; public static final int NO_SHADER = -1; @@ -926,6 +927,8 @@ else if (this.inertiaFactor == INERTIA_MASSIVE) return var4 + " HMD"; case FREEMOVE_RUNINPLACE: return var4 + " RunInPlace"; + case FREEMOVE_JOYPAD: + return var4 + " Joy/Pad"; } case FOV_REDUCTION: return this.useFOVReduction ? var4 + "ON" : var4 + "OFF"; @@ -1188,7 +1191,10 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) this.vrFreeMoveMode = FREEMOVE_RUNINPLACE; break; case FREEMOVE_RUNINPLACE: - this.vrFreeMoveMode = FREEMOVE_CONTROLLER; + this.vrFreeMoveMode = FREEMOVE_JOYPAD; + break; + case FREEMOVE_JOYPAD: + this.vrFreeMoveMode = FREEMOVE_CONTROLLER; break; } break; diff --git a/src/net/minecraft/client/model/ModelPlayerVR.java b/src/net/minecraft/client/model/ModelPlayerVR.java index d2e3d86..1cf3922 100644 --- a/src/net/minecraft/client/model/ModelPlayerVR.java +++ b/src/net/minecraft/client/model/ModelPlayerVR.java @@ -303,10 +303,10 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI armor.bipedLeftArm.rotateAngleX = this.leftshoulder.rotateAngleX; armor.bipedRightArm.rotateAngleY = this.rightShoulder.rotateAngleY; armor.bipedRightArm.rotateAngleX = this.rightShoulder.rotateAngleX; -// this.bipedLeftArm.scaleY = 0.5f; -// this.bipedLeftArmwear.scaleY = 0.5f; -// this.bipedRightArm.scaleY = 0.5f; -// this.bipedRightArmwear.scaleY = 0.5f; + this.bipedLeftArm.scaleY = 0.5f; + this.bipedLeftArmwear.scaleY = 0.5f; + this.bipedRightArm.scaleY = 0.5f; + this.bipedRightArmwear.scaleY = 0.5f; if(rotInfo.reverse){ this.rightShoulder.setRotationPoint(5.0F, 2.0F , 0.0F); @@ -318,10 +318,10 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI } }else { -// this.bipedLeftArm.scaleY = 1; -// this.bipedLeftArmwear.scaleY = 1; -// this.bipedRightArm.scaleY =1; -// this.bipedRightArmwear.scaleY =1; + this.bipedLeftArm.scaleY = 1; + this.bipedLeftArmwear.scaleY = 1; + this.bipedRightArm.scaleY =1; + this.bipedRightArmwear.scaleY =1; this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F); @@ -334,13 +334,16 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI this.vrHMD.isHidden = true; break; case 1: - // this.vrHMD.setTextureLocation(this.BLACK_HMD); + this.vrHMD.setTextureLocation(this.BLACK_HMD); break; case 2: - // this.vrHMD.setTextureLocation(this.GOLD_HMD); + this.vrHMD.setTextureLocation(this.GOLD_HMD); break; case 3: - // this.vrHMD.setTextureLocation(this.DIAMOND_HMD); + this.vrHMD.setTextureLocation(this.DIAMOND_HMD); + break; + case 4: + this.vrHMD.setTextureLocation(this.DIAMOND_HMD); break; }