I have scoured the internet looking for an up to date tutorial on updating a forge mod. The only ones I have found have been for older Minecraft versions that still use a bin folder which no longer exists. I am trying to update a 1.7.10 mod to 1.8, but I have run into a few problems in doing so. The mod in question is the Emotes mod for Minecraft 1.7.10. The tutorials I see look simple, but things have changed since then. Could I get any help on this?
It all seems simple when you put it like that, but there is a bit more to it than that. Some of the classes change from version to version, so those things have to be fixed. So far I have gotten the majority of the Emotes mod for 1.7.10 updated to 1.8, but have an error in the EmotesHandler classes. The error I am getting is modelArmor, modelArmorChestplate, and modelBipedMain cannot be resolved to a type. I tried building the mod anyway with newest version of forge using forge gradle. When I try that I get Execution failed for task 'compileJava'. As a secondary note, I did manage to take the original source code and compile it for the version it was initially made for which is version 1.7.10. I cannot figure out why I keep getting an error with the new version of forge and not with the old one. I followed several tutorials already, with several Google searches on the error, but all the fixes I tried did not work for me.
First thing to do, assuming you're using Eclipse, is Control+Shift+O to import any packages that the class relies on that aren't already listed. If that doesn't work, post in the Mod Development section including the code you're having problems with and the exact error message you're getting.
package vazkii.emotes.client.emote.base;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.WeakHashMap;
import java.util.regex.Pattern;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
public final class EmoteHandler {
public static Map<String, Class<? extends EmoteBase>> emoteMap = new TreeMap();
private static WeakHashMap<EntityPlayer, EmoteBase> playerEmotes = new WeakHashMap();
private static List<EntityPlayer> updatedPlayers = new ArrayList();
public static void putEmote(EntityPlayer player, String emoteName) {
if(emoteMap.containsKey(emoteName))
putEmote(player, emoteMap.get(emoteName));
else player.addChatComponentMessage(new ChatComponentText("That emote doesn't exist. Try /emote list.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
}
public static void putEmote(EntityPlayer player, Class<? extends EmoteBase> clazz) {
ModelBiped model = getPlayerModel();
ModelBiped armorModel = getPlayerArmorModel();
ModelBiped armorLegModel = getPlayerArmorLegModel();
System.out.println(model.bipedHead.rotateAngleY);
if(model.bipedHead.rotateAngleY < 0)
model.bipedHead.rotateAngleY = 2 * (float) Math.PI - model.bipedHead.rotateAngleY;
try {
if(playerEmotes.containsKey(player))
player.addChatComponentMessage(new ChatComponentText("You're already doing an emote.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
else playerEmotes.put(player, clazz.getConstructor(EntityPlayer.class, ModelBiped.class, ModelBiped.class, ModelBiped.class).newInstance(player, model, armorModel, armorLegModel));
} catch(Exception e) {
e.printStackTrace();
}
}
public static void updateEmotes(Entity e) {
if(e instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) e;
if(playerEmotes.containsKey(player)) {
EmoteBase emote = playerEmotes.get(player);
if(emote.isDone()) {
playerEmotes.remove(player);
resetModel(getPlayerModel());
resetModel(getPlayerArmorModel());
resetModel(getPlayerArmorLegModel());
}
else emote.update(!updatedPlayers.contains(player));
updatedPlayers.add(player);
}
}
}
public static void clearPlayerList() {
updatedPlayers.clear();
}
private static ModelBiped getPlayerModel() {
//instance cannot be resolved or is not a field
RenderPlayer render = (RenderPlayer) RenderManager.instance.entityRenderMap.get(EntityPlayer.class);
//modelBipedMain cannot be resolved or is not a field
return render.modelBipedMain;
}
private static ModelBiped getPlayerArmorModel() {
//instance cannot be resolved or is not a field
RenderPlayer render = (RenderPlayer) RenderManager.instance.entityRenderMap.get(EntityPlayer.class);
//modelArmorChestplate cannot be resolved or is not a field
return render.modelArmorChestplate;
}
private static ModelBiped getPlayerArmorLegModel() {
//instance cannot be resolved or is not a field
RenderPlayer render = (RenderPlayer) RenderManager.instance.entityRenderMap.get(EntityPlayer.class);
//modelArmor cannot be resolved or is not a field
return render.modelArmor;
}
private static void resetModel(ModelBiped model) {
model.bipedHead.rotateAngleZ = 0F;
model.bipedHeadwear.rotateAngleZ = 0F;
model.bipedBody.rotateAngleZ = 0F;
model.bipedRightLeg.rotateAngleZ = 0F;
model.bipedLeftLeg.rotateAngleZ = 0F;
}
public static IChatComponent buildEmoteListStr() {
final String split = "{\"text\":\", \"},";
final String button = "{\"text\":\"[%emote%]\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/emote %emote%\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"%emote% - Click to execute this emote\",\"color\":\"yellow\"}}},";
String str = "[{\"text\":\"Emote List: \"},";
int i = 0;
for(String emote : emoteMap.keySet()) {
String btn = button.replaceAll("%emote%", emote);
if(i % 2 != 0)
btn = btn.replaceAll("aqua", "green");
str = str + btn + split;
i++;
}
str = str.replaceAll(Pattern.quote("," + split) + "$", "]");
//The method func_150699_a(String) is undefined for the type IChatComponent.Serializer
return IChatComponent.Serializer.func_150699_a(str);
}
}
Here is the code I am having trouble with. I have put comments before each section that has an error. This is the only portion that eclipse shows errors and everything else is fine. Additionally, when I attempt to make a hot fix for this by setting the return for the functions as null, I try to build it and get the error in gradle "cannot find symbol PacketHandler.INSTANCE.sendToAll(new PacketEmote(args[0], sender.getCommandSenderName()));" when eclipse tells me that there is nothing wrong with that portion of the code. I determined that these errors are the only ones preventing me from building it. I was able to compile it with 1.8.8 forge and load it into minecraft by setting the above functions return statements to null and modifying the above line of code to PacketHandler.INSTANCE.sendToAll(new PacketEmote(args[0], null)); too. This fixed the errors and allowed the build to succeed and load the mod, but did not allow the mod to function as intended. Once these errors are fixed correctly, the mod will build and should work as intended. On a side note, I have done ctrl+shift+o to import packages and still have the same problem.
I have scoured the internet looking for an up to date tutorial on updating a forge mod. The only ones I have found have been for older Minecraft versions that still use a bin folder which no longer exists. I am trying to update a 1.7.10 mod to 1.8, but I have run into a few problems in doing so. The mod in question is the Emotes mod for Minecraft 1.7.10. The tutorials I see look simple, but things have changed since then. Could I get any help on this?
Download the latest version of a mod, place it in the mod folder, remove the outdated version. Not that hard to intuit.
WARNING:
My output of snark depends on your output of stupidity.
My patience wears thin on strawmen and lies.
It all seems simple when you put it like that, but there is a bit more to it than that. Some of the classes change from version to version, so those things have to be fixed. So far I have gotten the majority of the Emotes mod for 1.7.10 updated to 1.8, but have an error in the EmotesHandler classes. The error I am getting is modelArmor, modelArmorChestplate, and modelBipedMain cannot be resolved to a type. I tried building the mod anyway with newest version of forge using forge gradle. When I try that I get Execution failed for task 'compileJava'. As a secondary note, I did manage to take the original source code and compile it for the version it was initially made for which is version 1.7.10. I cannot figure out why I keep getting an error with the new version of forge and not with the old one. I followed several tutorials already, with several Google searches on the error, but all the fixes I tried did not work for me.
Here is the code I am having trouble with. I have put comments before each section that has an error. This is the only portion that eclipse shows errors and everything else is fine. Additionally, when I attempt to make a hot fix for this by setting the return for the functions as null, I try to build it and get the error in gradle "cannot find symbol PacketHandler.INSTANCE.sendToAll(new PacketEmote(args[0], sender.getCommandSenderName()));" when eclipse tells me that there is nothing wrong with that portion of the code. I determined that these errors are the only ones preventing me from building it. I was able to compile it with 1.8.8 forge and load it into minecraft by setting the above functions return statements to null and modifying the above line of code to PacketHandler.INSTANCE.sendToAll(new PacketEmote(args[0], null)); too. This fixed the errors and allowed the build to succeed and load the mod, but did not allow the mod to function as intended. Once these errors are fixed correctly, the mod will build and should work as intended. On a side note, I have done ctrl+shift+o to import packages and still have the same problem.
I have a tutorial for updating 1.7.10 to 1.8.x http://jabelarminecraft.blogspot.com/p/minecraft-forge-converting-your-mod.html