mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 20:22:28 +00:00
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:
1 parent
c6a21d0d62
commit
30d532f4fc
133 files changed
+50213
-35519
No files matched your search
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -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
|
||||
{
|
||||
+3
-1
@@ -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;
|
||||
+3
-1
@@ -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
|
||||
{
|
||||
+4
-2
@@ -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;
|
||||
|
||||
+5
-2
@@ -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
|
||||
{
|
||||
|
||||
+7
-4
@@ -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)
|
||||
+8
-5
@@ -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
|
||||
+2
-1
@@ -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;
|
||||
+3
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user