mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Handle mod duplicate detection much better. Default the name of a mod to it's id.
Fix up the block registry problem. Fix the packetsend from c->s actually being "disconnect" :)
This commit is contained in:
1 parent
5872b31781
commit
e64296e109
6 files changed
+60
-7
No files matched your search
@@ -399,6 +399,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
@Override
|
||||
public void sendPacket(Packet packet)
|
||||
{
|
||||
client.field_71439_g.field_71174_a.func_72546_b(packet);
|
||||
client.field_71439_g.field_71174_a.func_72552_c(packet);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.BiMap;
|
||||
@@ -142,6 +143,10 @@ public class FMLModContainer implements ModContainer
|
||||
modMetadata.dependencies = dependencies;
|
||||
modMetadata.dependants = dependants;
|
||||
}
|
||||
if (Strings.isNullOrEmpty(modMetadata.name))
|
||||
{
|
||||
modMetadata.name = getModId();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
@@ -43,8 +44,13 @@ import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multiset.Entry;
|
||||
import com.google.common.collect.Multisets;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.collect.TreeMultimap;
|
||||
|
||||
import cpw.mods.fml.common.LoaderState.ModState;
|
||||
import cpw.mods.fml.common.discovery.ContainerType;
|
||||
@@ -286,11 +292,46 @@ public class Loader
|
||||
discoverer.findModDirMods(canonicalModsDir);
|
||||
|
||||
mods.addAll(discoverer.identifyMods());
|
||||
identifyDuplicates(mods);
|
||||
namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
|
||||
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
|
||||
return discoverer;
|
||||
}
|
||||
|
||||
private class ModIdComparator implements Comparator<ModContainer>
|
||||
{
|
||||
@Override
|
||||
public int compare(ModContainer o1, ModContainer o2)
|
||||
{
|
||||
return o1.getModId().compareTo(o2.getModId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void identifyDuplicates(List<ModContainer> mods)
|
||||
{
|
||||
boolean foundDupe = false;
|
||||
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
|
||||
for (ModContainer mc : mods)
|
||||
{
|
||||
if (mc.getSource() != null)
|
||||
{
|
||||
dupsearch.put(mc, mc.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
|
||||
for (Entry<ModContainer> e : duplist.entrySet())
|
||||
{
|
||||
if (e.getCount() > 1)
|
||||
{
|
||||
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
|
||||
foundDupe = true;
|
||||
}
|
||||
}
|
||||
if (foundDupe) { throw new LoaderException(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -160,9 +160,6 @@ public class GameRegistry
|
||||
if (Loader.instance().isInState(LoaderState.CONSTRUCTING))
|
||||
{
|
||||
FMLLog.warning("The mod %s is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event.", Loader.instance().activeModContainer());
|
||||
} else if (!Loader.instance().isInState(LoaderState.PREINITIALIZATION))
|
||||
{
|
||||
FMLLog.warning("The mod %s is attempting to register a block after the statistics have loaded. This will reset the statistics for the game", Loader.instance().activeModContainer().getModId());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ of cpw/mods/fml/common/network/Player
|
||||
net.minecraft.src.EntityPlayer cpw/mods/fml/common/network/Player
|
||||
# block -> blockproxy
|
||||
aif cpw/mods/fml/common/registry/BlockProxy
|
||||
net/minecraft/src/Block cpw/mods/fml/common/registry/BlockProxy
|
||||
net.minecraft.src.Block cpw/mods/fml/common/registry/BlockProxy
|
||||
# item -> itemproxy
|
||||
rg cpw/mods/fml/common/registry/ItemProxy
|
||||
net/minecraft/src/Item cpw/mods/fml/common/registry/ItemProxy
|
||||
net.minecraft.src.Item cpw/mods/fml/common/registry/ItemProxy
|
||||
@@ -31,4 +31,14 @@ org.objectweb.asm.Type.getDescriptor(net.minecraft.src.CraftingManager.class.get
|
||||
|
||||
com.google.common.collect.Tables.newCustomTable(new HashMap<String,Map<String,List<String>>(), new com.google.common.base.Supplier() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
byte[] bytes = new byte[] {0, 0, 0, 1, 0, 0, 0, -107, 0, 0, 22, 83, 0, 0, 25, -48, 0, 0, 8, 70, 0, 0, 32, 80, 0, 0, 0, 0, 0, 33, 1, 44, 74, 0, 0, 0, 0, 75, 0, 0, 0, 0, 76, 0, 0, 0, 0, 77, 0, 0, 0, 0, 78, 0, 0, 0, 0, 79, 0, 0, 0, 0, 81, 0, 0, 0, 0, 80, 0, 0, 0, 0, 83, 0, 0, 0, 0, 82, 0, 0, 0, 0, 85, 0, 0, 0, 0, 84, 0, 0, 0, 0, 23, 0, 22, 0, 25, 0, 24, 0, -102, 0, 0, 127, 0, 0, 0, 0};
|
||||
new cpw.mods.fml.common.network.EntitySpawnPacket().consumePacket(bytes)
|
||||
|
||||
108 - 27 - 4
|
||||
Reference in new issue
Block a user