Skip to content

Commit

Permalink
Merge pull request #3 from SecretAgent12/Unknown025-Ultimate
Browse files Browse the repository at this point in the history
Unknown025 ultimate
  • Loading branch information
SecretAgent12 committed Mar 6, 2022
2 parents 05b9b64 + cf7ee2b commit b01a94b
Show file tree
Hide file tree
Showing 16 changed files with 2,618 additions and 2,673 deletions.
11 changes: 9 additions & 2 deletions src/main/java/com/flansmod/client/KeyInputHandler.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.flansmod.client;

import com.flansmod.client.gui.GuiSelectAmmo;
import com.flansmod.common.network.PacketGetPlayerClasses;
import org.lwjgl.input.Keyboard;

import com.flansmod.api.IControllable;
Expand Down Expand Up @@ -40,8 +41,9 @@ public class KeyInputHandler {
public static KeyBinding reloadKey = new KeyBinding("Reload key", Keyboard.KEY_R, "Flan's Mod");
public static KeyBinding selectPreferredAmmo = new KeyBinding("Select Preferred Ammo key", Keyboard.KEY_P, "Flan's Mod");
public static KeyBinding gunModeKey = new KeyBinding("Gun Mode key", Keyboard.KEY_F, "Flan's Mod");
public static KeyBinding teamsMenuKey = new KeyBinding("Teams Menu Key", Keyboard.KEY_G, "Flan's Mod");
public static KeyBinding teamsScoresKey = new KeyBinding("Teams Scores Key", Keyboard.KEY_H, "Flan's Mod");
public static KeyBinding teamsMenuKey = new KeyBinding("Minigames Select Team Key", Keyboard.KEY_G, "Flan's Mod");
public static KeyBinding teamsScoresKey = new KeyBinding("Minigames Scores Key", Keyboard.KEY_H, "Flan's Mod");
public static KeyBinding teamsSelectClassKey = new KeyBinding("Minigames Select Class Key", Keyboard.KEY_O, "Flan's Mod");
public static KeyBinding leftRollKey = new KeyBinding("Roll Left Key", Keyboard.KEY_Z, "Flan's Mod");
public static KeyBinding rightRollKey = new KeyBinding("Roll Right Key", Keyboard.KEY_X, "Flan's Mod");
public static KeyBinding gearKey = new KeyBinding("Gear Up / Down Key", Keyboard.KEY_L, "Flan's Mod");
Expand Down Expand Up @@ -74,6 +76,7 @@ public KeyInputHandler() {
ClientRegistry.registerKeyBinding(gunModeKey);
ClientRegistry.registerKeyBinding(teamsMenuKey);
ClientRegistry.registerKeyBinding(teamsScoresKey);
ClientRegistry.registerKeyBinding(teamsSelectClassKey);
ClientRegistry.registerKeyBinding(leftRollKey);
ClientRegistry.registerKeyBinding(rightRollKey);
ClientRegistry.registerKeyBinding(gearKey);
Expand Down Expand Up @@ -107,6 +110,10 @@ public void onKeyInput(KeyInputEvent event) {
mc.displayGuiScreen(new GuiTeamScores());
return;
}
if(teamsSelectClassKey.isPressed()){
FlansMod.getPacketHandler().sendToServer(new PacketGetPlayerClasses());
return;
}
if (reloadKey.isPressed() && FlansModClient.shootTime(false) <= 0) {
FlansMod.getPacketHandler().sendToServer(new PacketReload(false));
return;
Expand Down
101 changes: 46 additions & 55 deletions src/main/java/com/flansmod/client/tmt/ModelPool.java
Original file line number Diff line number Diff line change
@@ -1,63 +1,54 @@
package com.flansmod.client.tmt;

import com.flansmod.common.FlansMod;
import cpw.mods.fml.common.Loader;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import com.flansmod.common.FlansMod;

import cpw.mods.fml.common.Loader;
public class ModelPool {
public static final Class<ModelPoolObjEntry> OBJ = ModelPoolObjEntry.class;
private static final Map<String, ModelPoolEntry> modelMap = new HashMap<>();
private static final String[] resourceDir = new String[]{
"/resources/models/",
"/resources/mod/models/",
"/Flan/"
};

public class ModelPool
{
public static ModelPoolEntry addFile(String file, Class modelClass, Map<String, TransformGroup> group, Map<String, TextureGroup> textureGroup)
{
ModelPoolEntry entry = null;
if(modelMap.containsKey(file))
{
entry = modelMap.get(file);
entry.applyGroups(group, textureGroup);
return entry;
}
try
{
entry = (ModelPoolEntry)modelClass.newInstance();
}
catch(Exception e)
{
FlansMod.log("A new " + entry.getClass().getName() + " could not be initialized.");
FlansMod.log(e.getMessage());
return null;
}
File modelFile = null;
for(int i = 0; i < resourceDir.length && (modelFile == null || !modelFile.exists()); i++)
{
String absPath = new File(Loader.instance().getConfigDir().getParent(), resourceDir[i]).getAbsolutePath();
if(!absPath.endsWith("/") || !absPath.endsWith("\\"))
absPath+= "/";
modelFile = entry.checkValidPath(absPath + file);
}
if(modelFile == null || !modelFile.exists())
{
FlansMod.log("The model with the name " + file + " does not exist.");
return null;
}
entry.groups = new HashMap<String, TransformGroupBone>();
entry.textures = new HashMap<String, TextureGroup>();
entry.name = file;
entry.setGroup("0");
entry.setTextureGroup("0");
entry.getModel(modelFile);
entry.applyGroups(group, textureGroup);
modelMap.put(file, entry);
return entry;
}

private static Map<String, ModelPoolEntry> modelMap = new HashMap<String, ModelPoolEntry>();
private static String[] resourceDir = new String[] {
"/resources/models/",
"/resources/mod/models/",
"/Flan/"
};
public static final Class OBJ = ModelPoolObjEntry.class;
public static ModelPoolEntry addFile(String file, Class<?> modelClass, Map<String, TransformGroup> group, Map<String, TextureGroup> textureGroup) {
ModelPoolEntry entry = null;
if (modelMap.containsKey(file)) {
entry = modelMap.get(file);
entry.applyGroups(group, textureGroup);
return entry;
}
try {
entry = (ModelPoolEntry) modelClass.newInstance();
} catch (Exception e) {
FlansMod.log("A new " + entry.getClass().getName() + " could not be initialized.");
FlansMod.log(e.getMessage());
return null;
}
File modelFile = null;
for (int i = 0; i < resourceDir.length && (modelFile == null || !modelFile.exists()); i++) {
String absPath = new File(Loader.instance().getConfigDir().getParent(), resourceDir[i]).getAbsolutePath();
if (!absPath.endsWith("/") || !absPath.endsWith("\\"))
absPath += "/";
modelFile = entry.checkValidPath(absPath + file);
}
if (modelFile == null || !modelFile.exists()) {
FlansMod.log("The model with the name " + file + " does not exist.");
return null;
}
entry.groups = new HashMap<>();
entry.textures = new HashMap<>();
entry.name = file;
entry.setGroup("0");
entry.setTextureGroup("0");
entry.getModel(modelFile);
entry.applyGroups(group, textureGroup);
modelMap.put(file, entry);
return entry;
}
}
Loading

0 comments on commit b01a94b

Please sign in to comment.