Pass 1: Most patches are restored.

NOTES: 1. Network is completely broken. 2. GameRegistry is partially broken. 3. ID sync is not in.
This commit is contained in:
Christian committed 2013-12-02 23:48:26 -05:00
1 parent c6a21d0d62
commit 30d532f4fc
133 files changed
+50213 -35519

No files matched your search

@@ -22,34 +22,23 @@ import java.util.logging.Logger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.ReloadableResourceManager;
import net.minecraft.client.resources.ResourcePack;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import com.google.common.collect.Maps;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.DuplicateModsFoundException;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -63,14 +52,12 @@ import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.WrongMinecraftVersionException;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.ModMissingPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnPacket;
import cpw.mods.fml.common.network.packet.ModMissingPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.toposort.ModSortingException;
import cpw.mods.fml.relauncher.Side;
@@ -128,12 +115,12 @@ public class FMLClientHandler implements IFMLSidedHandler
private boolean serverShouldBeKilledQuietly;
private List<ResourcePack> resourcePackList;
private List<IResourcePack> resourcePackList;
@SuppressWarnings("unused")
private ReloadableResourceManager resourceManager;
private IReloadableResourceManager resourceManager;
private Map<String, ResourcePack> resourcePackMap;
private Map<String, IResourcePack> resourcePackMap;
/**
* Called to start the whole game off
@@ -143,7 +130,7 @@ public class FMLClientHandler implements IFMLSidedHandler
* @param resourceManager The resource manager
*/
@SuppressWarnings("unchecked")
public void beginMinecraftLoading(Minecraft minecraft, @SuppressWarnings("rawtypes") List resourcePackList, ReloadableResourceManager resourceManager)
public void beginMinecraftLoading(Minecraft minecraft, @SuppressWarnings("rawtypes") List resourcePackList, IReloadableResourceManager resourceManager)
{
client = minecraft;
this.resourcePackList = resourcePackList;
@@ -229,7 +216,7 @@ public class FMLClientHandler implements IFMLSidedHandler
* Also initializes key bindings
*
*/
@SuppressWarnings({ "deprecation", "unchecked" })
@SuppressWarnings({ "deprecation" })
public void finishMinecraftLoading()
{
if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null)
@@ -252,11 +239,8 @@ public class FMLClientHandler implements IFMLSidedHandler
return;
}
client.field_71416_A.LOAD_SOUND_SYSTEM = true;
// Reload resources
client.func_110436_a();
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o);
loading = false;
KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y);
}
@@ -292,29 +276,26 @@ public class FMLClientHandler implements IFMLSidedHandler
{
if (wrongMC != null)
{
client.func_71373_a(new GuiWrongMinecraft(wrongMC));
showGuiScreen(new GuiWrongMinecraft(wrongMC));
}
else if (modsMissing != null)
{
client.func_71373_a(new GuiModsMissing(modsMissing));
showGuiScreen(new GuiModsMissing(modsMissing));
}
else if (dupesFound != null)
{
client.func_71373_a(new GuiDupesFound(dupesFound));
showGuiScreen(new GuiDupesFound(dupesFound));
}
else if (modSorting != null)
{
client.func_71373_a(new GuiSortingProblem(modSorting));
showGuiScreen(new GuiSortingProblem(modSorting));
}
else if (customError != null)
{
client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError));
showGuiScreen(new GuiCustomModLoadingErrorScreen(customError));
}
else
{
// Force renderengine to reload and re-initialize all textures
// client.field_71446_o.func_78352_b();
// TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
}
}
/**
@@ -349,7 +330,7 @@ public class FMLClientHandler implements IFMLSidedHandler
public void displayGuiScreen(EntityPlayer player, GuiScreen gui)
{
if (client.field_71439_g==player && gui != null) {
client.func_71373_a(gui);
client.func_147108_a(gui);
}
}
@@ -389,7 +370,7 @@ public class FMLClientHandler implements IFMLSidedHandler
public void showGuiScreen(Object clientGuiElement)
{
GuiScreen gui = (GuiScreen) clientGuiElement;
client.func_71373_a(gui);
client.func_147108_a(gui);
}
@SuppressWarnings("rawtypes")
@@ -410,8 +391,8 @@ public class FMLClientHandler implements IFMLSidedHandler
else
{
entity = (Entity)(cls.getConstructor(World.class).newInstance(wc));
int offset = packet.entityId - entity.field_70157_k;
entity.field_70157_k = packet.entityId;
int offset = packet.entityId - entity.func_145782_y();
entity.func_145769_d(packet.entityId);
entity.func_70012_b(packet.scaledX, packet.scaledY, packet.scaledZ, packet.scaledYaw, packet.scaledPitch);
if (entity instanceof EntityLiving)
{
@@ -423,7 +404,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
for (int j = 0; j < parts.length; j++)
{
parts[j].field_70157_k += offset;
parts[j].func_145769_d(parts[j].func_145782_y() + offset);
}
}
}
@@ -434,7 +415,7 @@ public class FMLClientHandler implements IFMLSidedHandler
if (entity instanceof IThrowableEntity)
{
Entity thrower = client.field_71439_g.field_70157_k == packet.throwerId ? client.field_71439_g : wc.func_73045_a(packet.throwerId);
Entity thrower = client.field_71439_g.func_145782_y() == packet.throwerId ? client.field_71439_g : wc.func_73045_a(packet.throwerId);
((IThrowableEntity)entity).setThrower(thrower);
}
@@ -498,19 +479,10 @@ public class FMLClientHandler implements IFMLSidedHandler
return client.func_71401_C();
}
@Override
public void sendPacket(Packet packet)
{
if(client.field_71439_g != null)
{
client.field_71439_g.field_71174_a.func_72552_c(packet);
}
}
@Override
public void displayMissingMods(ModMissingPacket modMissingPacket)
{
client.func_71373_a(new GuiModsMissingForServer(modMissingPacket));
showGuiScreen(new GuiModsMissingForServer(modMissingPacket));
}
/**
@@ -521,84 +493,12 @@ public class FMLClientHandler implements IFMLSidedHandler
return loading;
}
@Override
public void handleTinyPacket(NetHandler handler, Packet131MapData mapData)
{
((NetClientHandler)handler).fmlPacket131Callback(mapData);
}
@Override
public void setClientCompatibilityLevel(byte compatibilityLevel)
{
NetClientHandler.setConnectionCompatibilityLevel(compatibilityLevel);
}
@Override
public byte getClientCompatibilityLevel()
{
return NetClientHandler.getConnectionCompatibilityLevel();
}
public void warnIDMismatch(MapDifference<Integer, ItemData> idDifferences, boolean mayContinue)
{
GuiIdMismatchScreen mismatch = new GuiIdMismatchScreen(idDifferences, mayContinue);
client.func_71373_a(mismatch);
}
public void callbackIdDifferenceResponse(boolean response)
{
if (response)
{
serverShouldBeKilledQuietly = false;
GameData.releaseGate(true);
client.continueWorldLoading();
}
else
{
serverShouldBeKilledQuietly = true;
GameData.releaseGate(false);
// Reset and clear the client state
client.func_71403_a((WorldClient)null);
client.func_71373_a(null);
}
}
@Override
public boolean shouldServerShouldBeKilledQuietly()
{
return serverShouldBeKilledQuietly;
}
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
{
ValueDifference<ItemData> vd = mismatch.getValue();
if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
{
criticalMismatch = true;
}
}
if (!criticalMismatch)
{
// We'll carry on with this connection, and just log a message instead
return;
}
// Nuke the connection
((NetClientHandler)toKill).func_72553_e();
// Stop GuiConnecting
GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r);
// pulse the network manager queue to clear cruft
mgr.func_74428_b();
// Nuke the world client
client.func_71403_a((WorldClient)null);
// Show error screen
warnIDMismatch(s, false);
}
/**
* Is this GUI type open?
*
@@ -619,7 +519,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
try
{
ResourcePack pack = (ResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container);
IResourcePack pack = (IResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container);
resourcePackList.add(pack);
resourcePackMap.put(container.getModId(), pack);
}
@@ -642,7 +542,7 @@ public class FMLClientHandler implements IFMLSidedHandler
client.func_110436_a();
}
public ResourcePack getResourcePackFor(String modId)
public IResourcePack getResourcePackFor(String modId)
{
return resourcePackMap.get(modId);
}
@@ -26,12 +26,12 @@ public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
public void func_73866_w_()
{
super.func_73866_w_();
this.customException.initGui(this, field_73886_k);
this.customException.initGui(this, field_146289_q);
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.customException.drawScreen(this, field_73886_k, p_73863_1_, p_73863_2_, p_73863_3_);
this.func_146276_q_();
this.customException.drawScreen(this, field_146289_q, p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@@ -38,18 +38,18 @@ public class GuiDupesFound extends GuiErrorScreen
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.func_146276_q_();
int offset = Math.max(85 - dupes.dupes.size() * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "You have mod sources that are duplicate within your system", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "You have mod sources that are duplicate within your system", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "Mod Id : File name", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Mod Id : File name", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=5;
for (Entry<ModContainer, File> mc : dupes.dupes.entries())
{
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("%s : %s", mc.getKey().getModId(), mc.getValue().getName()), this.field_73880_f / 2, offset, 0xEEEEEE);
this.func_73732_a(this.field_146289_q, String.format("%s : %s", mc.getKey().getModId(), mc.getValue().getName()), this.field_146294_l / 2, offset, 0xEEEEEE);
}
}
}
@@ -1,106 +0,0 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.resources.I18n;
import com.google.common.collect.Lists;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import cpw.mods.fml.common.registry.ItemData;
public class GuiIdMismatchScreen extends GuiYesNo {
private List<String> missingIds = Lists.newArrayList();
private List<String> mismatchedIds = Lists.newArrayList();
private boolean allowContinue;
public GuiIdMismatchScreen(MapDifference<Integer, ItemData> idDifferences, boolean allowContinue)
{
super(null,"ID mismatch", "Should I continue?", 1);
field_73942_a = this;
for (Entry<Integer, ItemData> entry : idDifferences.entriesOnlyOnLeft().entrySet())
{
missingIds.add(String.format("ID %d from Mod %s is missing", entry.getValue().getItemId(), entry.getValue().getModId(), entry.getValue().getItemType()));
}
for (Entry<Integer, ValueDifference<ItemData>> entry : idDifferences.entriesDiffering().entrySet())
{
ItemData world = entry.getValue().leftValue();
// ItemData game = entry.getValue().rightValue();
mismatchedIds.add(String.format("ID %d is mismatched between world and game", world.getItemId()));
}
this.allowContinue = allowContinue;
}
@Override
public void func_73878_a(boolean choice, int p_73878_2_)
{
FMLClientHandler.instance().callbackIdDifferenceResponse(choice);
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
if (!allowContinue && field_73887_h.size() == 2)
{
field_73887_h.remove(0);
}
int offset = Math.max(85 - (missingIds.size() + mismatchedIds.size()) * 10, 30);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found ID mismatches", this.field_73880_f / 2, 10, 0xFFFFFF);
this.func_73732_a(this.field_73886_k, "Complete details are in the log file", this.field_73880_f / 2, 20, 0xFFFFFF);
int maxLines = 20;
for (String s: missingIds) {
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
offset += 10;
maxLines --;
if (maxLines < 0) break;
if (offset >= this.field_73881_g - 30) break;
}
if (maxLines > 0 && offset < this.field_73881_g - 30)
{
for (String s: mismatchedIds) {
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
offset += 10;
maxLines --;
if (maxLines < 0) break;
if (offset >= this.field_73881_g - 30) break;
}
}
if (allowContinue)
{
this.func_73732_a(this.field_73886_k, "Do you wish to continue loading?", this.field_73880_f / 2, this.field_73881_g - 30, 0xFFFFFF);
}
else
{
this.func_73732_a(this.field_73886_k, "You cannot connect to this server", this.field_73880_f / 2, this.field_73881_g - 30, 0xFFFFFF);
}
// super.super. Grrr
for (int var4 = 0; var4 < this.field_73887_h.size(); ++var4)
{
GuiButton var5 = (GuiButton)this.field_73887_h.get(var4);
var5.field_73743_d = this.field_73881_g - 20;
if (!allowContinue)
{
var5.field_73746_c = this.field_73880_f / 2 - 75;
var5.field_73744_e = I18n.func_135053_a("gui.done");
}
var5.func_73737_a(this.field_73882_e, p_73863_1_, p_73863_2_);
}
}
}
@@ -26,12 +26,11 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSmallButton;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.ResourcePack;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@@ -90,28 +89,28 @@ public class GuiModList extends GuiScreen
listWidth=Math.max(listWidth,getFontRenderer().func_78256_a(mod.getVersion()) + 10);
}
listWidth=Math.min(listWidth, 150);
this.field_73887_h.add(new GuiSmallButton(6, this.field_73880_f / 2 - 75, this.field_73881_g - 38, I18n.func_135053_a("gui.done")));
this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 - 75, this.field_146295_m - 38, I18n.func_135052_a("gui.done")));
this.modList=new GuiSlotModList(this, mods, listWidth);
this.modList.registerScrollButtons(this.field_73887_h, 7, 8);
this.modList.registerScrollButtons(this.field_146292_n, 7, 8);
}
@Override
protected void func_73875_a(GuiButton button) {
if (button.field_73742_g)
protected void func_146284_a(GuiButton button) {
if (button.field_146124_l)
{
switch (button.field_73741_f)
switch (button.field_146127_k)
{
case 6:
this.field_73882_e.func_71373_a(this.mainMenu);
this.field_146297_k.func_147108_a(this.mainMenu);
return;
}
}
super.func_73875_a(button);
super.func_146284_a(button);
}
public int drawLine(String line, int offset, int shifty)
{
int r = this.field_73886_k.func_78276_b(line, offset, shifty, 0xd7edea);
this.field_146289_q.func_78276_b(line, offset, shifty, 0xd7edea);
return shifty + 10;
}
@@ -119,7 +118,7 @@ public class GuiModList extends GuiScreen
public void func_73863_a(int p_571_1_, int p_571_2_, float p_571_3_)
{
this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_);
this.func_73732_a(this.field_73886_k, "Mod List", this.field_73880_f / 2, 16, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Mod List", this.field_146294_l / 2, 16, 0xFFFFFF);
int offset = this.listWidth + 20;
if (selectedMod != null) {
GL11.glEnable(GL11.GL_BLEND);
@@ -129,8 +128,8 @@ public class GuiModList extends GuiScreen
if (!logoFile.isEmpty())
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
TextureManager tm = field_73882_e.func_110434_K();
ResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
TextureManager tm = field_146297_k.func_110434_K();
IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
try
{
BufferedImage logo = null;
@@ -149,7 +148,7 @@ public class GuiModList extends GuiScreen
if (logo != null)
{
ResourceLocation rl = tm.func_110578_a("modlogo", new DynamicTexture(logo));
this.field_73882_e.field_71446_o.func_110577_a(rl);
this.field_146297_k.field_71446_o.func_110577_a(rl);
Dimension dim = new Dimension(logo.getWidth(), logo.getHeight());
double scaleX = dim.width / 200.0;
double scaleY = dim.height / 65.0;
@@ -177,7 +176,7 @@ public class GuiModList extends GuiScreen
;
}
}
this.field_73886_k.func_78261_a(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
this.field_146289_q.func_78261_a(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
shifty += 12;
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);
@@ -188,18 +187,18 @@ public class GuiModList extends GuiScreen
shifty = drawLine(String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()), offset, shifty);
shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty);
shifty = drawLine(selectedMod.getMetadata().childMods.isEmpty() ? "No child mods for this mod" : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()), offset, shifty);
int rightSide = this.field_73880_f - offset - 20;
int rightSide = this.field_146294_l - offset - 20;
if (rightSide > 20)
{
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, rightSide, 0xDDDDDD);
}
} else {
offset = ( this.listWidth + this.field_73880_f ) / 2;
this.func_73732_a(this.field_73886_k, selectedMod.getName(), offset, 35, 0xFFFFFF);
this.func_73732_a(this.field_73886_k, String.format("Version: %s",selectedMod.getVersion()), offset, 45, 0xFFFFFF);
this.func_73732_a(this.field_73886_k, String.format("Mod State: %s",Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF);
this.func_73732_a(this.field_73886_k, "No mod information found", offset, 65, 0xDDDDDD);
this.func_73732_a(this.field_73886_k, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD);
offset = ( this.listWidth + this.field_146294_l ) / 2;
this.func_73732_a(this.field_146289_q, selectedMod.getName(), offset, 35, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, String.format("Version: %s",selectedMod.getVersion()), offset, 45, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, String.format("Mod State: %s",Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "No mod information found", offset, 65, 0xDDDDDD);
this.func_73732_a(this.field_146289_q, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD);
}
GL11.glDisable(GL11.GL_BLEND);
}
@@ -207,11 +206,11 @@ public class GuiModList extends GuiScreen
}
Minecraft getMinecraftInstance() {
return field_73882_e;
return field_146297_k;
}
FontRenderer getFontRenderer() {
return field_73886_k;
return field_146289_q;
}
/**
@@ -36,11 +36,11 @@ public class GuiModsMissing extends GuiErrorScreen
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.func_146276_q_();
int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "The mods and versions listed below could not be found", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=5;
for (ArtifactVersion v : modsMissing.missingMods)
{
@@ -50,13 +50,13 @@ public class GuiModsMissing extends GuiErrorScreen
DefaultArtifactVersion dav = (DefaultArtifactVersion)v;
if (dav.getRange() != null && dav.getRange().isUnboundedAbove())
{
this.func_73732_a(this.field_73886_k, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.field_73880_f / 2, offset, 0xEEEEEE);
this.func_73732_a(this.field_146289_q, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.field_146294_l / 2, offset, 0xEEEEEE);
continue;
}
}
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
this.func_73732_a(this.field_146289_q, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_146294_l / 2, offset, 0xEEEEEE);
}
offset+=20;
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_146294_l / 2, offset, 0xFFFFFF);
}
}
@@ -14,9 +14,8 @@ package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSmallButton;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.common.network.ModMissingPacket;
import cpw.mods.fml.common.network.packet.ModMissingPacket;
import cpw.mods.fml.common.versioning.ArtifactVersion;
public class GuiModsMissingForServer extends GuiScreen
@@ -32,32 +31,32 @@ public class GuiModsMissingForServer extends GuiScreen
@Override
public void func_73866_w_()
{
this.field_73887_h.add(new GuiSmallButton(1, this.field_73880_f / 2 - 75, this.field_73881_g - 38, I18n.func_135053_a("gui.done")));
this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 75, this.field_146295_m - 38, I18n.func_135052_a("gui.done")));
}
@Override
protected void func_73875_a(GuiButton p_73875_1_)
protected void func_146284_a(GuiButton p_73875_1_)
{
if (p_73875_1_.field_73742_g && p_73875_1_.field_73741_f == 1)
if (p_73875_1_.field_146124_l && p_73875_1_.field_146127_k == 1)
{
FMLClientHandler.instance().getClient().func_71373_a(null);
FMLClientHandler.instance().showGuiScreen(null);
}
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.func_146276_q_();
int offset = Math.max(85 - modsMissing.getModList().size() * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader could not connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader could not connect to this server", this.field_146294_l / 2, offset, 0xFFFFFF);
offset += 10;
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "The mods and versions listed below could not be found", this.field_146294_l / 2, offset, 0xFFFFFF);
offset += 10;
this.func_73732_a(this.field_73886_k, "They are required to play on this server", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "They are required to play on this server", this.field_146294_l / 2, offset, 0xFFFFFF);
offset += 5;
for (ArtifactVersion v : modsMissing.getModList())
{
offset += 10;
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
this.func_73732_a(this.field_146289_q, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_146294_l / 2, offset, 0xEEEEEE);
}
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
}
@@ -132,15 +132,15 @@ public abstract class GuiScrollingList
public void actionPerformed(GuiButton button)
{
if (button.field_73742_g)
if (button.field_146124_l)
{
if (button.field_73741_f == this.scrollUpActionId)
if (button.field_146127_k == this.scrollUpActionId)
{
this.scrollDistance -= (float)(this.slotHeight * 2 / 3);
this.initialMouseClickY = -2.0F;
this.applyScrollLimits();
}
else if (button.field_73741_f == this.scrollDownActionId)
else if (button.field_146127_k == this.scrollDownActionId)
{
this.scrollDistance += (float)(this.slotHeight * 2 / 3);
this.initialMouseClickY = -2.0F;
@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@@ -31,7 +31,7 @@ public class GuiSlotModList extends GuiScrollingList
public GuiSlotModList(GuiModList parent, ArrayList<ModContainer> mods, int listWidth)
{
super(parent.getMinecraftInstance(), listWidth, parent.field_73881_g, 32, parent.field_73881_g - 65 + 4, 10, 35);
super(parent.getMinecraftInstance(), listWidth, parent.field_146295_m, 32, parent.field_146295_m - 65 + 4, 10, 35);
this.parent=parent;
this.mods=mods;
}
@@ -57,7 +57,7 @@ public class GuiSlotModList extends GuiScrollingList
@Override
protected void drawBackground()
{
this.parent.func_73873_v_();
this.parent.func_146276_q_();
}
@Override
@@ -22,23 +22,23 @@ public class GuiSortingProblem extends GuiScreen {
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.func_146276_q_();
int offset = Math.max(85 - (failedList.getVisitedNodes().size() + 3) * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "A mod sorting cycle was detected and loading cannot continue", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "A mod sorting cycle was detected and loading cannot continue", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("The first mod in the cycle is %s", failedList.getFirstBadNode()), this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, String.format("The first mod in the cycle is %s", failedList.getFirstBadNode()), this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "The remainder of the cycle involves these mods", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "The remainder of the cycle involves these mods", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=5;
for (ModContainer mc : failedList.getVisitedNodes())
{
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()), this.field_73880_f / 2, offset, 0xEEEEEE);
this.func_73732_a(this.field_146289_q, String.format("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()), this.field_146294_l / 2, offset, 0xEEEEEE);
}
offset+=20;
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_146294_l / 2, offset, 0xFFFFFF);
}
}
@@ -32,15 +32,15 @@ public class GuiWrongMinecraft extends GuiErrorScreen
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.func_146276_q_();
int offset = 75;
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.field_146294_l / 2, offset, 0xFFFFFF);
offset+=5;
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.field_73880_f / 2, offset, 0xEEEEEE);
this.func_73732_a(this.field_146289_q, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.field_146294_l / 2, offset, 0xEEEEEE);
offset+=20;
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_146294_l / 2, offset, 0xFFFFFF);
}
}
@@ -13,7 +13,7 @@
package cpw.mods.fml.client.registry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@@ -36,7 +36,7 @@ public class ClientRegistry
@SuppressWarnings("unchecked")
public static void bindTileEntitySpecialRenderer(Class <? extends TileEntity> tileEntityClass, TileEntitySpecialRenderer specialRenderer)
{
TileEntityRenderer.field_76963_a.field_76966_m.put(tileEntityClass, specialRenderer);
specialRenderer.func_76893_a(TileEntityRenderer.field_76963_a);
TileEntityRendererDispatcher.field_147556_a.field_147559_m.put(tileEntityClass, specialRenderer);
specialRenderer.func_147497_a(TileEntityRendererDispatcher.field_147556_a);
}
}
@@ -116,7 +116,7 @@ public class KeyBindingRegistry
for (int i = 0; i < keyBindings.length; i++)
{
KeyBinding keyBinding = keyBindings[i];
int keyCode = keyBinding.field_74512_d;
int keyCode = keyBinding.func_151463_i();
boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode));
if (state != keyDown[i] || (state && repeatings[i]))
{
@@ -26,13 +26,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerListenThread;
import net.minecraft.server.ThreadMinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.world.World;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
@@ -43,15 +37,13 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Lists;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.server.FMLServerHandler;
@@ -179,7 +171,7 @@ public class FMLCommonHandler
public Side getEffectiveSide()
{
Thread thr = Thread.currentThread();
if ((thr instanceof ThreadMinecraftServer) || (thr instanceof ServerListenThread))
if ((thr.getName().equals("Server thread")))
{
return Side.SERVER;
}
@@ -343,7 +335,7 @@ public class FMLCommonHandler
sidedDelegate.adjustEntityLocationOnClient(entitySpawnAdjustmentPacket);
}
public void onServerStart(DedicatedServer dedicatedServer)
public void onServerStart(MinecraftServer dedicatedServer)
{
FMLServerHandler.instance();
sidedDelegate.beginServerLoading(dedicatedServer);
@@ -401,11 +393,6 @@ public class FMLCommonHandler
}
}
public void handleTinyPacket(NetHandler handler, Packet131MapData mapData)
{
sidedDelegate.handleTinyPacket(handler, mapData);
}
public void handleWorldDataSave(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)
{
for (ModContainer mc : Loader.instance().getModList())
@@ -416,7 +403,7 @@ public class FMLCommonHandler
if (wac != null)
{
NBTTagCompound dataForWriting = wac.getDataForWriting(handler, worldInfo);
tagCompound.func_74766_a(mc.getModId(), dataForWriting);
tagCompound.func_74782_a(mc.getModId(), dataForWriting);
}
}
}
@@ -434,7 +421,7 @@ public class FMLCommonHandler
}
handlerSet.add(handler);
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
worldInfo.setAdditionalProperties(additionalProperties);
// worldInfo.setAdditionalProperties(additionalProperties);
for (ModContainer mc : Loader.instance().getModList())
{
if (mc instanceof InjectedModContainer)
@@ -457,11 +444,6 @@ public class FMLCommonHandler
return sidedDelegate.shouldServerShouldBeKilledQuietly();
}
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
{
sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
}
public void handleServerStopped()
{
sidedDelegate.serverStopped();
@@ -502,4 +484,8 @@ public class FMLCommonHandler
return sidedDelegate.getCurrentLanguage();
}
public void bootstrap()
{
}
}
@@ -87,10 +87,10 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
{
if (tag.func_74764_b("ModList"))
{
NBTTagList modList = tag.func_74761_m("ModList");
NBTTagList modList = tag.func_150295_c("ModList", (byte)10);
for (int i = 0; i < modList.func_74745_c(); i++)
{
NBTTagCompound mod = (NBTTagCompound) modList.func_74743_b(i);
NBTTagCompound mod = modList.func_150305_b(i);
String modId = mod.func_74779_i("ModId");
String modVersion = mod.func_74779_i("ModVersion");
ModContainer container = Loader.instance().getIndexedModList().get(modId);
@@ -107,9 +107,9 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
}
if (tag.func_74764_b("ModItemData"))
{
NBTTagList modList = tag.func_74761_m("ModItemData");
Set<ItemData> worldSaveItems = GameData.buildWorldItemData(modList);
GameData.validateWorldSave(worldSaveItems);
NBTTagList modList = tag.func_150295_c("ModItemData", (byte)10);
// Set<ItemData> worldSaveItems = GameData.buildWorldItemData(modList);
// GameData.validateWorldSave(worldSaveItems);
}
else
{
@@ -14,18 +14,11 @@ package cpw.mods.fml.common;
import java.util.List;
import com.google.common.collect.MapDifference;
import net.minecraft.entity.Entity;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.ModMissingPacket;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.network.packet.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnPacket;
import cpw.mods.fml.common.network.packet.ModMissingPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.relauncher.Side;
@@ -49,20 +42,10 @@ public interface IFMLSidedHandler
MinecraftServer getServer();
void sendPacket(Packet packet);
void displayMissingMods(ModMissingPacket modMissingPacket);
void handleTinyPacket(NetHandler handler, Packet131MapData mapData);
void setClientCompatibilityLevel(byte compatibilityLevel);
byte getClientCompatibilityLevel();
boolean shouldServerShouldBeKilledQuietly();
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
void addModAsResource(ModContainer container);
void updateResourcePackList();
@@ -23,8 +23,6 @@ import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import net.minecraft.crash.CallableMinecraftVersion;
import com.google.common.base.CharMatcher;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -160,7 +158,7 @@ public class Loader
private Loader()
{
modClassLoader = new ModClassLoader(getClass().getClassLoader());
String actualMCVersion = new CallableMinecraftVersion(null).func_71493_a();
String actualMCVersion = "1.7.2";
if (!mccversion.equals(actualMCVersion))
{
FMLLog.severe("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, actualMCVersion);
@@ -17,20 +17,20 @@ import java.io.InputStreamReader;
import java.util.Map;
import java.util.logging.Level;
import argo.jdom.JdomParser;
import argo.jdom.JsonNode;
import argo.jdom.JsonRootNode;
import argo.saj.InvalidSyntaxException;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
public class MetadataCollection
{
private static JdomParser parser = new JdomParser();
private String modListVersion;
private ModMetadata[] modList;
private Map<String, ModMetadata> metadatas = Maps.newHashMap();
@SuppressWarnings("unused")
private int metadataVersion = 1;
public static MetadataCollection from(InputStream inputStream, String sourceName)
{
@@ -42,17 +42,29 @@ public class MetadataCollection
InputStreamReader reader = new InputStreamReader(inputStream);
try
{
JsonRootNode root = parser.parse(reader);
if (root.hasElements())
MetadataCollection collection;
Gson gson = new GsonBuilder().create();
JsonParser parser = new JsonParser();
JsonElement rootElement = parser.parse(reader);
if (rootElement.isJsonArray())
{
return parse10ModInfo(root);
collection = new MetadataCollection();
JsonArray jsonList = rootElement.getAsJsonArray();
collection.modList = new ModMetadata[jsonList.size()];
int i = 0;
for (JsonElement mod : jsonList)
{
collection.modList[i++]=gson.fromJson(mod, ModMetadata.class);
}
}
else
{
return parseModInfo(root);
collection = gson.fromJson(rootElement, MetadataCollection.class);
}
collection.parseModMetadataList();
return collection;
}
catch (InvalidSyntaxException e)
catch (JsonParseException e)
{
FMLLog.log(Level.SEVERE, e, "The mcmod.info file in %s cannot be parsed as valid JSON. It will be ignored", sourceName);
return new MetadataCollection();
@@ -63,27 +75,12 @@ public class MetadataCollection
}
}
private static MetadataCollection parseModInfo(JsonRootNode root)
{
MetadataCollection mc = new MetadataCollection();
mc.metadataVersion = Integer.parseInt(root.getNumberValue("modinfoversion"));
mc.parseModMetadataList(root.getNode("modlist"));
return mc;
}
private static MetadataCollection parse10ModInfo(JsonRootNode root)
private void parseModMetadataList()
{
MetadataCollection mc = new MetadataCollection();
mc.parseModMetadataList(root);
return mc;
}
private void parseModMetadataList(JsonNode metadataList)
{
for (JsonNode node : metadataList.getElements())
for (ModMetadata modMetadata : modList)
{
ModMetadata mmd = new ModMetadata(node);
metadatas.put(mmd.modId, mmd);
metadatas.put(modMetadata.modId, modMetadata);
}
}
@@ -17,7 +17,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -12,29 +12,16 @@
package cpw.mods.fml.common;
import static argo.jdom.JsonNodeBuilders.aStringBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import argo.jdom.JsonNode;
import argo.jdom.JsonStringNode;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
import cpw.mods.fml.common.functions.ModNameFunction;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.VersionParser;
/**
* @author cpw
@@ -42,29 +29,7 @@ import cpw.mods.fml.common.versioning.VersionParser;
*/
public class ModMetadata
{
private static final class JsonStringConverter implements Function<JsonNode, Object>
{
public Object apply(JsonNode arg0)
{
if (arg0.hasElements())
{
return Lists.transform(arg0.getElements(), new JsonArrayConverter());
}
else
{
return arg0.getText();
}
}
}
private static final class JsonArrayConverter implements Function<JsonNode, String>
{
public String apply(JsonNode arg0)
{
return arg0.getText();
}
}
@SerializedName("modid")
public String modId;
public String name;
public String description = "";
@@ -88,59 +53,10 @@ public class ModMetadata
public List<ArtifactVersion> dependants;
public boolean autogenerated;
@SuppressWarnings("unchecked")
public ModMetadata(JsonNode node)
{
Map<JsonStringNode, Object> processedFields = Maps.transformValues(node.getFields(), new JsonStringConverter());
modId = (String)processedFields.get(aStringBuilder("modid"));
if (Strings.isNullOrEmpty(modId))
{
FMLLog.log(Level.SEVERE, "Found an invalid mod metadata file - missing modid");
throw new LoaderException();
}
name = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("name")));
description = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("description")));
url = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("url")));
updateUrl = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("updateUrl")));
logoFile = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("logoFile")));
version = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("version")));
credits = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("credits")));
parent = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("parent")));
authorList = Objects.firstNonNull(((List<String>)processedFields.get(aStringBuilder("authors"))),Objects.firstNonNull(((List<String>)processedFields.get(aStringBuilder("authorList"))), authorList));
requiredMods = processReferences(processedFields.get(aStringBuilder("requiredMods")), HashSet.class);
dependencies = processReferences(processedFields.get(aStringBuilder("dependencies")), ArrayList.class);
dependants = processReferences(processedFields.get(aStringBuilder("dependants")), ArrayList.class);
useDependencyInformation = Boolean.parseBoolean(Strings.nullToEmpty((String)processedFields.get(aStringBuilder("useDependencyInformation"))));
}
public ModMetadata()
{
}
@SuppressWarnings("unchecked")
private <T extends Collection<ArtifactVersion>> T processReferences(Object refs, Class<? extends T> retType)
{
T res = null;
try
{
res = retType.newInstance();
}
catch (Exception e)
{
// unpossible
}
if (refs == null)
{
return res;
}
for (String ref : ((List<String>)refs))
{
res.add(VersionParser.parseVersionReference(ref));
}
return res;
}
public String getChildModCountString()
{
return String.format("%d child mod%s", childMods.size(), childMods.size() != 1 ? "s" : "");
@@ -12,48 +12,18 @@
package cpw.mods.fml.common.network;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_REQUEST;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketAddress;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.network.*;
import net.minecraft.network.packet.*;
import net.minecraft.server.MinecraftServer;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.world.EnumGameType;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.hash.Hashing;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.InjectedModContainer;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.discovery.ASMDataTable;
import cpw.mods.fml.common.network.FMLPacket.Type;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.relauncher.Side;
public class FMLNetworkHandler
{
private static final int FML_HASH = Hashing.murmur3_32().hashString("FML").asInt();
/* private static final int FML_HASH = Hashing.murmur3_32().hashString("FML").asInt();
private static final int PROTOCOL_VERSION = 0x2;
private static final FMLNetworkHandler INSTANCE = new FMLNetworkHandler();
@@ -182,13 +152,13 @@ public class FMLNetworkHandler
}
}
/**
*//**
* @param netLoginHandler
* @param server
* @param address
* @param userName
* @return if the user can carry on
*/
*//*
private boolean handleVanillaLoginKick(NetLoginHandler netLoginHandler, MinecraftServer server, SocketAddress address, String userName)
{
// Vanilla reasons first
@@ -435,14 +405,29 @@ public class FMLNetworkHandler
FMLCommonHandler.instance().handleTinyPacket(handler, mapData);
}
}
public static int getCompatibilityLevel()
*/
public static void fmlHandshake(ServerConfigurationManager scm, NetworkManager manager, EntityPlayerMP player)
{
return PROTOCOL_VERSION;
NetHandlerPlayServer nethandler = new NetHandlerPlayServer(scm.func_72365_p(), manager, player);
player.field_71135_a = null;
scm.func_72355_a(manager, player, nethandler);
}
public static boolean vanillaLoginPacketCompatibility()
public static void openGui(EntityPlayer entityPlayer, Object mod, int modGuiId, World world, int x, int y, int z)
{
return FMLCommonHandler.instance().getSidedDelegate().getClientCompatibilityLevel() == 0;
// TODO Auto-generated method stub
}
public static void makeEntitySpawnAdjustment(int func_145782_y, EntityPlayerMP p_73117_1_, int field_73128_d, int field_73129_e, int field_73126_f)
{
// TODO Auto-generated method stub
}
public static Packet getEntitySpawningPacket(Entity field_73132_a)
{
// TODO Auto-generated method stub
return null;
}
}
@@ -0,0 +1,17 @@
package cpw.mods.fml.common.network;
import net.minecraft.network.play.server.S3FPacketCustomPayload;
/**
* Handle packets <em>from</em> the server at the client.
*
* @author cpw
*
*/
public interface IClientSidePacketHandler extends IPacketHandler {
/**
* Handle the custompayload packet
* @param packet
*/
public void handleCustomPayload(S3FPacketCustomPayload packet);
}
@@ -1,27 +1,10 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.network;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
/**
* Marker for packet handlers
* @author cpw
*
*/
public interface IPacketHandler {
public interface IPacketHandler
{
/**
* Recieve a packet from one of the registered channels for this packet handler
* @param manager The network manager this packet arrived from
* @param packet The packet itself
* @param player A dummy interface representing the player - it can be cast into a real player instance if needed
*/
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player);
}
@@ -0,0 +1,50 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.network;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetworkManager;
/**
* Whenever a network connection is constructed, the appropriate factory method is called, once for each channel.
* Return null if you don't want a handler for a specific channel on a specific side.
*
* @author cpw
*
*/
public interface IPacketHandlerFactory
{
/**
* Return the list of channels this packet handler factory wants to claim
* @return a list of channels
*/
public String[] channels();
/**
* Return a client side packet handler for the specified channel or null if it is not handled on this side
*
* @param mod
* @param manager
* @param clientPlayHandler
* @param channel
* @return
*/
public IClientSidePacketHandler makeClientPacketHandler(NetworkMod mod, NetworkManager manager, INetHandler clientPlayHandler, String channel);
/**
* Return a server side packet handler for the specified channel or null if it is not handled on this side
* @param mod
* @param manager
* @param serverPlayHandler
* @return
*/
public IServerSidePacketHandler makeServerPacketHandler(NetworkMod mod, NetworkManager manager, INetHandler serverPlayHandler);
}
@@ -0,0 +1,13 @@
package cpw.mods.fml.common.network;
import net.minecraft.network.play.client.C17PacketCustomPayload;
/**
* Handle packets <em>from</em> the client at the server.
*
* @author cpw
*
*/
public interface IServerSidePacketHandler {
public void handleCustomPayload(C17PacketCustomPayload packet);
}
@@ -0,0 +1,16 @@
package cpw.mods.fml.common.network;
import io.netty.util.AttributeKey;
import net.minecraft.network.NetworkManager;
import com.google.common.collect.ListMultimap;
public class NetworkDispatcher {
private static final AttributeKey<NetworkDispatcher> FML_DISPATCHER = new AttributeKey<NetworkDispatcher>("fml:dispatcher");
private static final AttributeKey<ListMultimap<String,IPacketHandler>> FML_PACKET_HANDLERS = new AttributeKey<ListMultimap<String,IPacketHandler>>("fml:packet_handlers");
public static NetworkDispatcher get(NetworkManager manager)
{
return manager.channel().attr(FML_DISPATCHER).get();
}
}
@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@@ -17,61 +17,32 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import cpw.mods.fml.common.Mod;
/**
* {@link Mod} classes also adorned with this annotation are considered network capable mods.
* They require a {@link IPacketHandlerFactory} that will generate instances of packet handlers.
* They are version checked for compatibility between client and server. The default mechanism
* matches the {@link Mod#version()} on client and server. It can be overridden with either a
* {@link #versionBounds()} or a more complex {@link VersionCheckHandler}.
*
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface NetworkMod
{
/**
* Does this mod require the client side to be present when installed on a server?
*/
boolean clientSideRequired() default false;
/**
* Does this mod require the server side to be present when installed on a client?
*/
boolean serverSideRequired() default false;
/**
* A list of Packet250 network channels to register for this mod - these channels
* will be universal and will require a universal packethandler to handle them
*/
String[] channels() default {};
/**
* An optional range check for client to server communication version compatibility
*/
String versionBounds() default "";
/**
* A packet handler implementation for channels registered through this annotation
* - this packet handler will be universal and handle both client and server
* requests.
*/
Class<? extends IPacketHandler> packetHandler() default NULL.class;
Class<? extends IPacketHandlerFactory> packetHandlerFactory();
/**
* A tiny packet handler implementation based on {@link net.minecraft.network.packet.Packet131MapData} for "small"
* data packet loads.
* An optional range check for client to server communication version compatibility.
*/
Class<? extends ITinyPacketHandler> tinyPacketHandler() default NULL.class;
/**
* A connection handler implementation for this network mod
*/
Class<? extends IConnectionHandler> connectionHandler() default NULL.class;
/**
* A packet handler and channels to register for the client side
*/
SidedPacketHandler clientPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
/**
* A packet handler and channels to register for the server side
*/
SidedPacketHandler serverPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
/**
* Special dummy class for handling stupid annotation default values
* @author cpw
*
*/
static interface NULL extends IPacketHandler, IConnectionHandler, ITinyPacketHandler {};
String versionBounds() default "";
/**
* A marker for a method that will be offered the client's version string
* if more sophisticated version rejection handling is required:
@@ -84,15 +55,4 @@ public @interface NetworkMod
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface VersionCheckHandler { }
/**
* Bundles together a packet handler and it's associated channels for the sided packet handlers
* @author cpw
*
*/
public @interface SidedPacketHandler {
String[] channels();
Class<? extends IPacketHandler> packetHandler();
}
}
@@ -41,7 +41,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.FMLPacket.Type;
import cpw.mods.fml.common.network.packet.FMLPacket;
import cpw.mods.fml.common.network.packet.FMLPacket.Type;
import cpw.mods.fml.relauncher.Side;
/**
@@ -10,7 +10,7 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
@@ -20,6 +20,7 @@ import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.FMLNetworkHandler;
public class EntitySpawnAdjustmentPacket extends FMLPacket
{
@@ -10,7 +10,7 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -32,6 +32,8 @@ import com.google.common.io.ByteStreams;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.network.NetworkModHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
@@ -10,7 +10,7 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import java.util.Arrays;
import java.util.concurrent.ConcurrentMap;
@@ -26,6 +26,8 @@ import com.google.common.primitives.Ints;
import com.google.common.primitives.UnsignedBytes;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.FMLNetworkException;
import cpw.mods.fml.common.network.FMLNetworkHandler;
public abstract class FMLPacket
{
@@ -10,9 +10,9 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDMAP;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_IDMAP;
import java.io.IOException;
import java.util.Set;
@@ -32,6 +32,8 @@ import com.google.common.primitives.UnsignedBytes;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.FMLNetworkException;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.ItemData;
@@ -10,9 +10,9 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDENTIFIERS;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_IDENTIFIERS;
import java.util.Collection;
import java.util.Map;
@@ -26,6 +26,9 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.network.NetworkModHandler;
public class ModIdentifiersPacket extends FMLPacket
{
@@ -10,10 +10,10 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_REQUEST;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_RESPONSE;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_LIST_REQUEST;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_LIST_RESPONSE;
import java.util.List;
import java.util.Map;
@@ -33,6 +33,9 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.network.NetworkModHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
public class ModListRequestPacket extends FMLPacket
{
@@ -84,7 +87,7 @@ public class ModListRequestPacket extends FMLPacket
* This packet is executed on the client to evaluate the server's mod list against
* the client
*
* @see cpw.mods.fml.common.network.FMLPacket#execute(INetworkManager, FMLNetworkHandler, NetHandler, String)
* @see cpw.mods.fml.common.network.packet.FMLPacket#execute(INetworkManager, FMLNetworkHandler, NetHandler, String)
*/
@Override
public void execute(INetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
@@ -10,12 +10,12 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDENTIFIERS;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDMAP;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_RESPONSE;
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_MISSING;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_IDENTIFIERS;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_IDMAP;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_LIST_RESPONSE;
import static cpw.mods.fml.common.network.packet.FMLPacket.Type.MOD_MISSING;
import java.util.List;
import java.util.Map;
@@ -37,6 +37,9 @@ import com.google.common.io.ByteStreams;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.network.NetworkModHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.registry.GameData;
public class ModListResponsePacket extends FMLPacket
@@ -10,7 +10,7 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import java.util.List;
@@ -24,6 +24,7 @@ import com.google.common.io.ByteStreams;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange;
@@ -10,7 +10,7 @@
* cpw - implementation
*/
package cpw.mods.fml.common.network;
package cpw.mods.fml.common.network.packet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
@@ -20,6 +20,8 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import cpw.mods.fml.common.network.FMLNetworkHandler;
public class OpenGuiPacket extends FMLPacket
{
private int windowId;
@@ -16,6 +16,7 @@ import java.util.logging.Level;
import java.util.regex.Pattern;
import net.minecraft.launchwrapper.LaunchClassLoader;
import LZMA.LzmaInputStream;
import com.google.common.base.Joiner;
@@ -1,61 +0,0 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.registry;
import java.util.BitSet;
import net.minecraft.block.Block;
class BlockTracker
{
private static final BlockTracker INSTANCE = new BlockTracker();
private BitSet allocatedBlocks;
private BlockTracker()
{
allocatedBlocks = new BitSet(4096);
allocatedBlocks.set(0, 4096);
for (int i = 0; i < Block.field_71973_m.length; i++)
{
if (Block.field_71973_m[i]!=null)
{
allocatedBlocks.clear(i);
}
}
}
public static int nextBlockId()
{
return instance().getNextBlockId();
}
private int getNextBlockId()
{
int idx = allocatedBlocks.nextSetBit(0);
allocatedBlocks.clear(idx);
return idx;
}
private static BlockTracker instance()
{
return INSTANCE;
}
public static void reserveBlockId(int id)
{
instance().doReserveId(id);
}
private void doReserveId(int id)
{
allocatedBlocks.clear(id);
}
}
@@ -24,7 +24,7 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityTracker;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.SpawnListEntry;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import com.google.common.base.Function;
import com.google.common.collect.ArrayListMultimap;
@@ -38,7 +38,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnPacket;
public class EntityRegistry
{
@@ -389,7 +389,7 @@ public class GameData {
public static void validateRegistry()
{
for (int i = 0; i < Item.field_77698_e.length; i++)
/* for (int i = 0; i < Item.field_77698_e.length; i++)
{
if (Item.field_77698_e[i] != null)
{
@@ -404,6 +404,6 @@ public class GameData {
}
}
}
validated = true;
*/ validated = true;
}
}
@@ -19,6 +19,7 @@ import java.util.Random;
import java.util.Set;
import java.util.logging.Level;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@@ -154,20 +155,9 @@ public class GameRegistry
{
assert block != null : "registerBlock: block cannot be null";
assert itemclass != null : "registerBlock: itemclass cannot be null";
int blockItemId = block.field_71990_ca - 256;
Constructor<? extends ItemBlock> itemCtor;
Item i;
try
{
itemCtor = itemclass.getConstructor(int.class);
i = itemCtor.newInstance(blockItemId);
}
catch (NoSuchMethodException e)
{
itemCtor = itemclass.getConstructor(int.class, net.minecraft.block.Block.class);
i = itemCtor.newInstance(blockItemId, block);
}
GameRegistry.registerItem(i,name, modId);
Constructor<? extends ItemBlock> itemCtor = itemclass.getConstructor(net.minecraft.block.Block.class);
Item i = itemCtor.newInstance(block);
GameRegistry.registerItem(i, name, modId);
}
catch (Exception e)
{
@@ -198,14 +188,19 @@ public class GameRegistry
CraftingManager.func_77594_a().func_77592_b().add(recipe);
}
public static void addSmelting(int input, ItemStack output, float xp)
public static void addSmelting(Block input, ItemStack output, float xp)
{
FurnaceRecipes.func_77602_a().func_77600_a(input, output, xp);
FurnaceRecipes.func_77602_a().func_151393_a(input, output, xp);
}
public static void addSmelting(Item input, ItemStack output, float xp)
{
FurnaceRecipes.func_77602_a().func_151396_a(input, output, xp);
}
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
{
TileEntity.func_70306_a(tileEntityClass, id);
TileEntity.func_145826_a(tileEntityClass, id);
}
/**
@@ -218,8 +213,8 @@ public class GameRegistry
*/
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
{
TileEntity.func_70306_a(tileEntityClass, id);
Map<String,Class<?>> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_a", "field_70326_a", "a");
TileEntity.func_145826_a(tileEntityClass, id);
Map<String,Class<?>> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "field_145855_i");
for (String s: alternatives)
{
if (!teMappings.containsKey(s))
@@ -24,8 +24,7 @@ import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Tuple;
import net.minecraft.village.MerchantRecipeList;
import net.minecraft.world.gen.structure.ComponentVillageStartPiece;
import net.minecraft.world.gen.structure.StructureVillagePieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
@@ -67,7 +66,7 @@ public class VillagerRegistry
* @param random
* @param i
*/
StructureVillagePieceWeight getVillagePieceWeight(Random random, int i);
StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i);
/**
* The class of the root structure component to add to the village
@@ -87,7 +86,7 @@ public class VillagerRegistry
* @param p4
* @param p5
*/
Object buildComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1,
Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1,
int p2, int p3, int p4, int p5);
}
@@ -208,14 +207,14 @@ public class VillagerRegistry
public static void addExtraVillageComponents(@SuppressWarnings("rawtypes") ArrayList components, Random random, int i)
{
@SuppressWarnings("unchecked")
List<StructureVillagePieceWeight> parts = components;
List<StructureVillagePieces.PieceWeight> parts = components;
for (IVillageCreationHandler handler : instance().villageCreationHandlers.values())
{
parts.add(handler.getVillagePieceWeight(random, i));
}
}
public static Object getVillageComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, @SuppressWarnings("rawtypes") List pieces, Random random,
public static Object getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random,
int p1, int p2, int p3, int p4, int p5)
{
return instance().villageCreationHandlers.get(villagePiece.field_75090_a).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, p4, p5);
@@ -227,9 +226,9 @@ public class VillagerRegistry
{
if (min > 0 && max > 0)
{
EntityVillager.field_70958_bB.put(item.field_77779_bT, new Tuple(min, max));
EntityVillager.field_70958_bB.put(item, new Tuple(min, max));
}
EntityVillager.func_70948_a(list, item.func_77612_l(), random, chance);
EntityVillager.func_146091_a(list, item, random, chance);
}
@SuppressWarnings("unchecked")
@@ -237,9 +236,9 @@ public class VillagerRegistry
{
if (min > 0 && max > 0)
{
EntityVillager.field_70960_bC.put(item.field_77779_bT, new Tuple(min, max));
EntityVillager.field_70960_bC.put(item, new Tuple(min, max));
}
EntityVillager.func_70949_b(list, item.func_77612_l(), random, chance);
EntityVillager.func_146089_b(list, item.func_77612_l(), random, chance);
}
public static void applyRandomTrade(EntityVillager villager, Random rand)
@@ -38,9 +38,9 @@ import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.ModMissingPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.packet.EntitySpawnPacket;
import cpw.mods.fml.common.network.packet.ModMissingPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.ItemData;
+72 -74
View File
@@ -1,78 +1,76 @@
#Main FML Access Transformer configuration file
# TileEntity addMapping
public asp.a(Ljava/lang/Class;Ljava/lang/String;)V #MD:TileEntity/func_70306_a
public net.minecraft.tileentity.TileEntity.func_145826_a(Ljava/lang/Class;Ljava/lang/String;)V
# EntityList addMappings
public nt.a(Ljava/lang/Class;Ljava/lang/String;I)V #MD:EntityList/func_75618_a
public nt.a(Ljava/lang/Class;Ljava/lang/String;III)V #MD:EntityList/func_75614_a
public nt.b #FD:EntityList/field_75625_b #nameToClassMap
public nt.c #FD:EntityList/field_75626_c #classToNameMap
public nt.d #FD:EntityList/field_75623_d #idToClassMap
# RenderEngine
#public bba.h #FD:RenderEngine/field_78367_h #textureList # -- MISSING MAPPING # -- MISSING MAPPING
#public bge.g #FD:RenderEngine/field_78366_k #texturePack # -- MISSING MAPPING
# RenderManager
public bgl.q #FD:RenderManager/field_78729_o #renderers
# RenderBlocks - everything
public bfr.* #FD:RenderBlocks/*
public bfr.*() #MD:RenderBlocks/*
#RenderPlayer
#public-f bht.h #FD:RenderPlayer/field_77110_j #armorlist # -- MISSING MAPPING
#RenderBiped
public-f bgu.l #FD:RenderBiped/field_82424_k #armorlist
#StringTranslate
#public bp.b #FD:StringTranslate/field_74815_b # -- MISSING MAPPING
#public bp.e #FD:StringTranslate/field_74813_d # -- MISSING MAPPING
# TileEntityRenderer
public bjd.m #FD:TileEntityRenderer/field_76966_m
# CraftingManager - make the add recipe methods public
public aaf.a(Lye;[Ljava/lang/Object;)Laai; #MD:CraftingManager/func_92103_a
public aaf.b(Lye;[Ljava/lang/Object;)V #MD:CraftingManager/func_77596_b
# WeightedRandomItem
public mj.a #FD:WeightedRandomItem/field_76292_a #probability
# ItemStack
#public+f tv.c #FD:ItemStack/field_77993_c #itemId
# StatBase
public ku.a #FD:StatBase/field_75978_a #statName
# NetLoginHandler
public jy.a(Ljy;Z)Z #MD:NetLoginHandler/func_72531_a #'complete connection'
public jy.g #FD:NetLoginHandler/field_72543_h #userName
# EntityPlayerMP getNextWindowId
public jv.bN()V #MD:EntityPlayerMP/func_71117_bO
public jv.bY #FD:EntityPlayerMP/field_71139_cq
# EntityAITaskEntry
public pu #CL:EntityAITaskEntry
# EntityAITasks
public pt.a #FD:EntityAITasks/field_75782_a #taskList
# BlockChest
public ank.m(Labw;III)Z #MD:BlockChest/func_72292_n #isOcelotBlockingChest
# EntityLiving
#public ng.aU #FD:EntityLiving/field_70736_aM #carryoverDamage # -- MISSING MAPPING
public og.c #FD:EntityLiving/field_70714_bg #tasks
#public ng.bG #FD:EntityLiving/field_70703_bu #isJumping # -- MISSING MAPPING
# EntityAIOcelotSit
protected qg.a(Labw;III)Z #MD:EntityAIOcelotSit/func_75398_a #nearestSittableBlock
protected qg.f()Z #MD:EntityAIOcelotSit/func_75399_f #isblocksittable
# CallableMinecraftVersion - sanity check the MC version
public c #CL:CallableMinecraftVersion
public c.<init>(Lb;)V #MD:CallableMinecraftVersion/<init>(Lnet/minecraft/src/CrashReport;) #constructor
# EntityAnimal
public rp.bp #FD:EntityAnimal/field_70881_d #inLove
# WorldType
public acg.<init>(ILjava/lang/String;)V #MD:WorldType/<init>(ILjava/lang/String;)
public acg.<init>(ILjava/lang/String;I)V #MD:WorldType/<init>(ILjava/lang/String;I)
# ComponentVillage
public ajm #CL:ComponentVillage
# StructureStart
public aiv.a #FD:StructureStart/field_75075_a
# EntityVillager - minmax lists
public ub.a(Labm;ILjava/util/Random;F)V #MD:EntityVillager/func_70948_a #addBuy
public ub.b(Labm;ILjava/util/Random;F)V #MD:EntityVillager/func_70949_b #addSell
public ub.bB #FD:EntityVillager/field_70958_bB
public ub.bC #FD:EntityVillager/field_70960_bC
# GuiButtonMerchant
public axx #CL:GuiButtonMerchant
protected aux.a #FD:GuiYesNo/field_73942_a #guiScreen
public net.minecraft.entity.EntityList.func_75618_a(Ljava/lang/Class;Ljava/lang/String;I)V
public net.minecraft.entity.EntityList.func_75614_a(Ljava/lang/Class;Ljava/lang/String;III)V
public net.minecraft.entity.EntityList.field_75625_b #nameToClassMap
public net.minecraft.entity.EntityList.field_75626_c #classToNameMap
public net.minecraft.entity.EntityList.field_75623_d #idToClassMap
## RenderEngine
##public bba.h #FD:RenderEngine/field_78367_h #textureList # -- MISSING MAPPING # -- MISSING MAPPING
##public bge.g #FD:RenderEngine/field_78366_k #texturePack # -- MISSING MAPPING
## RenderManager
#public bgl.q #FD:RenderManager/field_78729_o #renderers
## RenderBlocks - everything
#public bfr.* #FD:RenderBlocks/*
#public bfr.*() #MD:RenderBlocks/*
##RenderPlayer
##public-f bht.h #FD:RenderPlayer/field_77110_j #armorlist # -- MISSING MAPPING
##RenderBiped
public-f net.minecraft.client.renderer.entity.RenderBiped.field_82424_k #armorlist
##StringTranslate
##public bp.b #FD:StringTranslate/field_74815_b # -- MISSING MAPPING
##public bp.e #FD:StringTranslate/field_74813_d # -- MISSING MAPPING
## TileEntityRendererDispatcher
public net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147559_m
## CraftingManager - make the add recipe methods public
public net.minecraft.item.crafting.CraftingManager.func_92103_a(Lnet.minecraft.item.ItemStack;[Ljava/lang/Object;)Lnet.minecraft.item.crafting.ShapedRecipes;
public net.minecraft.item.crafting.CraftingManager.func_77596_b(Lnet.minecraft.item.ItemStack;[Ljava/lang/Object;)V
## WeightedRandomItem
public net.minecraft.util.WeightedRandom$Item.field_76292_a #probability
## ItemStack
##public+f tv.c #FD:ItemStack/field_77993_c #itemId
## StatBase
#public ku.a #FD:StatBase/field_75978_a #statName
## NetLoginHandler
#public jy.a(Ljy;Z)Z #MD:NetLoginHandler/func_72531_a #'complete connection'
#public jy.g #FD:NetLoginHandler/field_72543_h #userName
## EntityPlayerMP getNextWindowId
#public jv.bN()V #MD:EntityPlayerMP/func_71117_bO
#public jv.bY #FD:EntityPlayerMP/field_71139_cq
## EntityAITaskEntry
#public pu #CL:EntityAITaskEntry
## EntityAITasks
#public pt.a #FD:EntityAITasks/field_75782_a #taskList
## BlockChest
#public ank.m(Labw;III)Z #MD:BlockChest/func_72292_n #isOcelotBlockingChest
## EntityLiving
##public ng.aU #FD:EntityLiving/field_70736_aM #carryoverDamage # -- MISSING MAPPING
#public og.c #FD:EntityLiving/field_70714_bg #tasks
##public ng.bG #FD:EntityLiving/field_70703_bu #isJumping # -- MISSING MAPPING
## EntityAIOcelotSit
#protected qg.a(Labw;III)Z #MD:EntityAIOcelotSit/func_75398_a #nearestSittableBlock
#protected qg.f()Z #MD:EntityAIOcelotSit/func_75399_f #isblocksittable
## CallableMinecraftVersion - sanity check the MC version
#public c #CL:CallableMinecraftVersion
#public c.<init>(Lb;)V #MD:CallableMinecraftVersion/<init>(Lnet/minecraft/src/CrashReport;) #constructor
## EntityAnimal
#public rp.bp #FD:EntityAnimal/field_70881_d #inLove
## WorldType
#public acg.<init>(ILjava/lang/String;)V #MD:WorldType/<init>(ILjava/lang/String;)
#public acg.<init>(ILjava/lang/String;I)V #MD:WorldType/<init>(ILjava/lang/String;I)
## ComponentVillage
#public ajm #CL:ComponentVillage
## StructureStart
#public aiv.a #FD:StructureStart/field_75075_a
## EntityVillager - minmax lists
public net.minecraft.entity.passive.EntityVillager.func_146091_a(Lnet.minecraft.village.MerchantRecipeList;Lnet.minecraft.item.Item;Ljava/util/Random;F)V # buy
public net.minecraft.entity.passive.EntityVillager.func_146089_b(Lnet.minecraft.village.MerchantRecipeList;Lnet.minecraft.item.Item;Ljava/util/Random;F)V # sell
public net.minecraft.entity.passive.EntityVillager.field_70958_bB
public net.minecraft.entity.passive.EntityVillager.field_70960_bC
## GuiButtonMerchant
#public axx #CL:GuiButtonMerchant
# Minecraft
public atv.D #FD:Minecraft/field_71425_J #running
public atv.N #FD:Minecraft/field_71446_o # textureManager
#public atv.D #FD:Minecraft/field_71425_J #running
public net.minecraft.client.Minecraft.field_71446_o # textureManager