mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
Implement override tracking and syncing.
Overrides MUST be registered within a tracked event so we know what mod it came from. This will allow servers/saves to select which mod 'wins' and becomes to active entry. This should also mean that when connecting to a vanilla server things will revert.
This commit is contained in:
1 parent
4b45eb8b68
commit
f4afb6f56c
5 files changed
+154
-35
No files matched your search
@@ -147,6 +147,16 @@ public final class FMLContainer extends DummyModContainer implements WorldAccess
|
||||
}
|
||||
data.setTag("aliases", aliases);
|
||||
|
||||
NBTTagList overrides = new NBTTagList();
|
||||
for (Entry<ResourceLocation, String> entry : e.getValue().overrides.entrySet())
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("K", entry.getKey().toString());
|
||||
tag.setString("V", entry.getValue().toString());
|
||||
aliases.appendTag(tag);
|
||||
}
|
||||
data.setTag("overrides", overrides);
|
||||
|
||||
int[] blocked = new int[e.getValue().blocked.size()];
|
||||
int idx = 0;
|
||||
for (Integer i : e.getValue().blocked)
|
||||
|
||||
+17
-1
@@ -184,12 +184,14 @@ public abstract class FMLHandshakeMessage {
|
||||
this.name = name;
|
||||
this.ids = entry.ids;
|
||||
this.dummied = entry.dummied;
|
||||
this.overrides = entry.overrides;
|
||||
}
|
||||
|
||||
private boolean hasMore;
|
||||
private ResourceLocation name;
|
||||
private Map<ResourceLocation, Integer> ids;
|
||||
private Set<ResourceLocation> dummied;
|
||||
private Map<ResourceLocation, String> overrides;
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buffer)
|
||||
@@ -206,13 +208,20 @@ public abstract class FMLHandshakeMessage {
|
||||
}
|
||||
|
||||
length = ByteBufUtils.readVarInt(buffer, 3);
|
||||
|
||||
dummied = Sets.newHashSet();
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
dummied.add(new ResourceLocation(ByteBufUtils.readUTF8String(buffer)));
|
||||
}
|
||||
|
||||
length = ByteBufUtils.readVarInt(buffer, 3);
|
||||
overrides = Maps.newHashMap();
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
overrides.put(new ResourceLocation(ByteBufUtils.readUTF8String(buffer)), ByteBufUtils.readUTF8String(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,6 +242,13 @@ public abstract class FMLHandshakeMessage {
|
||||
{
|
||||
ByteBufUtils.writeUTF8String(buffer, entry.toString());
|
||||
}
|
||||
|
||||
ByteBufUtils.writeVarInt(buffer, overrides.size(), 3);
|
||||
for (Entry<ResourceLocation, String> entry: overrides.entrySet())
|
||||
{
|
||||
ByteBufUtils.writeUTF8String(buffer, entry.getKey().toString());
|
||||
ByteBufUtils.writeUTF8String(buffer, entry.getValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, Integer> getIdMap()
|
||||
|
||||
Reference in new issue
Block a user