mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Merge branch '1.9.4'
This commit is contained in:
commit
caa61e1be9
332 files changed
+3806
-3131
No files matched your search
@@ -68,7 +68,7 @@ import net.minecraft.util.IThreadListener;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.storage.SaveFormatComparator;
|
||||
import net.minecraft.world.storage.WorldSummary;
|
||||
import net.minecraft.world.storage.SaveFormatOld;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
@@ -662,7 +662,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
@Override
|
||||
public NetworkManager getClientToServerNetworkManager()
|
||||
{
|
||||
return this.client.getNetHandler()!=null ? this.client.getNetHandler().getNetworkManager() : null;
|
||||
return this.client.getConnection()!=null ? this.client.getConnection().getNetworkManager() : null;
|
||||
}
|
||||
|
||||
public void handleClientWorldClosing(WorldClient world)
|
||||
@@ -683,7 +683,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
return new File(client.mcDataDir, "saves");
|
||||
}
|
||||
public void tryLoadExistingWorld(GuiWorldSelection selectWorldGUI, SaveFormatComparator comparator)
|
||||
public void tryLoadExistingWorld(GuiWorldSelection selectWorldGUI, WorldSummary comparator)
|
||||
{
|
||||
File dir = new File(getSavesDir(), comparator.getFileName());
|
||||
NBTTagCompound leveldat;
|
||||
|
||||
@@ -584,7 +584,7 @@ public class GuiModList extends GuiScreen
|
||||
for (ITextComponent part : line) {
|
||||
if (!(part instanceof TextComponentString))
|
||||
continue;
|
||||
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getChatComponentText_TextValue());
|
||||
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getText());
|
||||
if (k >= x)
|
||||
{
|
||||
GuiModList.this.handleComponentClick(part);
|
||||
|
||||
@@ -287,7 +287,7 @@ public abstract class GuiScrollingList
|
||||
{
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableFog();
|
||||
this.client.renderEngine.bindTexture(Gui.optionsBackground);
|
||||
this.client.renderEngine.bindTexture(Gui.OPTIONS_BACKGROUND);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float scale = 32.0F;
|
||||
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GuiButtonExt extends GuiButton
|
||||
{
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
GuiUtils.drawContinuousTexturedBox(BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int color = 14737632;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GuiCheckBox extends GuiButton
|
||||
if (this.visible)
|
||||
{
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.boxWidth && mouseY < this.yPosition + this.height;
|
||||
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
GuiUtils.drawContinuousTexturedBox(BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int color = 14737632;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package net.minecraftforge.fml.client.config;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
|
||||
{
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
GuiUtils.drawContinuousTexturedBox(GuiButton.BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int color = 14737632;
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ public class FMLCommonHandler
|
||||
{
|
||||
for (ICrashCallable call: crashCallables)
|
||||
{
|
||||
category.addCrashSectionCallable(call.getLabel(), call);
|
||||
category.setDetail(call.getLabel(), call);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.Mod.Metadata;
|
||||
import net.minecraftforge.fml.common.asm.transformers.BlamingTransformer;
|
||||
@@ -466,6 +467,10 @@ public class FMLModContainer implements ModContainer
|
||||
ModClassLoader modClassLoader = event.getModClassLoader();
|
||||
modClassLoader.addFile(source);
|
||||
modClassLoader.clearNegativeCacheFor(candidate.getClassList());
|
||||
|
||||
//Only place I could think to add this...
|
||||
MinecraftForge.preloadCrashClasses(event.getASMHarvestedData(), getModId(), candidate.getClassList());
|
||||
|
||||
Class<?> clazz = Class.forName(className, true, modClassLoader);
|
||||
|
||||
Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates();
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
* 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 net.minecraftforge.fml.common;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import net.minecraft.crash.ICrashReportDetail;
|
||||
|
||||
public interface ICrashCallable extends Callable<String>
|
||||
public interface ICrashCallable extends ICrashReportDetail<String>
|
||||
{
|
||||
String getLabel();
|
||||
}
|
||||
@@ -26,11 +26,14 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.ICrashReportDetail;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fml.common.LoaderState.ModState;
|
||||
import net.minecraftforge.fml.common.ModContainer.Disableable;
|
||||
import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
|
||||
import net.minecraftforge.fml.common.discovery.ModDiscoverer;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLLoadEvent;
|
||||
|
||||
@@ -131,7 +131,14 @@ public class ModClassLoader extends URLClassLoader
|
||||
"log4j-core-",
|
||||
"lwjgl-",
|
||||
"lwjgl_util-",
|
||||
"twitch-"
|
||||
"twitch-",
|
||||
"jline-",
|
||||
"jna-",
|
||||
"platform-",
|
||||
"oshi-core-",
|
||||
"netty-",
|
||||
"libraryjavasound-",
|
||||
"fastutil-"
|
||||
};
|
||||
for (String s : prefixes)
|
||||
{
|
||||
|
||||
+32
-1
@@ -15,6 +15,8 @@ import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.signature.SignatureReader;
|
||||
import org.objectweb.asm.signature.SignatureWriter;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
@@ -97,8 +99,16 @@ public class ModAPITransformer implements IClassTransformer {
|
||||
|
||||
private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs)
|
||||
{
|
||||
String ifaceName = interfaceName.replace('.', '/');
|
||||
final String ifaceName = interfaceName.replace('.', '/');
|
||||
boolean found = classNode.interfaces.remove(ifaceName);
|
||||
if (found && classNode.signature != null)
|
||||
{
|
||||
SignatureReader sr = new SignatureReader(classNode.signature);
|
||||
final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName);
|
||||
sr.accept(signatureWriter);
|
||||
classNode.signature = signatureWriter.toString();
|
||||
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed from type signature");
|
||||
}
|
||||
if (found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed", interfaceName);
|
||||
if (!found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s NOT removed - not found", interfaceName);
|
||||
|
||||
@@ -157,4 +167,25 @@ public class ModAPITransformer implements IClassTransformer {
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemovingSignatureWriter extends SignatureWriter
|
||||
{
|
||||
private final String ifaceName;
|
||||
|
||||
RemovingSignatureWriter(String ifaceName)
|
||||
{
|
||||
this.ifaceName = ifaceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClassType(String name)
|
||||
{
|
||||
if (name.equals(ifaceName)) {
|
||||
super.visitClassType("java/lang/Object");
|
||||
}
|
||||
else
|
||||
{
|
||||
super.visitClassType(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-5
@@ -134,11 +134,15 @@ public class TerminalTransformer implements IClassTransformer
|
||||
String callingClass = cause.length > 2 ? cause[3].getClassName() : "none";
|
||||
String callingParent = cause.length > 3 ? cause[4].getClassName() : "none";
|
||||
// FML is allowed to call system exit and the Minecraft applet (from the quit button), and the dedicated server (from itself)
|
||||
if (!(callingClass.startsWith("net.minecraftforge.fml.") ||
|
||||
("net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent)) ||
|
||||
("net.minecraft.server.gui.MinecraftServerGui$1".equals(callingClass) && "java.awt.AWTEventMulticaster".equals(callingParent)) ||
|
||||
("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent)))
|
||||
)
|
||||
boolean allowed = false;
|
||||
allowed |= callingClass.startsWith("net.minecraftforge.fml.");
|
||||
allowed |= callingClass.equals("net.minecraft.client.Minecraft") && callingParent.equals("net.minecraft.client.Minecraft");
|
||||
allowed |= callingClass.equals("net.minecraft.server.gui.MinecraftServerGui$1") && callingParent.equals("java.awt.AWTEventMulticaster");
|
||||
allowed |= callingClass.equals("net.minecraft.server.dedicated.DedicatedServer") && callingParent.equals("net.minecraft.server.MinecraftServer");
|
||||
allowed |= callingClass.equals("net.minecraft.server.dedicated.ServerHangWatchdog");
|
||||
allowed |= callingClass.equals("net.minecraft.server.dedicated.ServerHangWatchdog$1");
|
||||
|
||||
if (!allowed)
|
||||
{
|
||||
throw new ExitTrappedException();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
|
||||
if (file.isDirectory())
|
||||
{
|
||||
FMLLog.finer("Recursing into package %s", path + file.getName());
|
||||
exploreFileSystem(path + file.getName() + ".", file, harvestedMods, candidate, mc);
|
||||
exploreFileSystem(path + file.getName() + "/", file, harvestedMods, candidate, mc);
|
||||
continue;
|
||||
}
|
||||
Matcher match = classFile.matcher(file.getName());
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.LoaderException;
|
||||
@@ -30,6 +31,7 @@ import org.objectweb.asm.Type;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
public class ASMModParser
|
||||
{
|
||||
@@ -38,6 +40,7 @@ public class ASMModParser
|
||||
private int classVersion;
|
||||
private Type asmSuperType;
|
||||
private LinkedList<ModAnnotation> annotations = Lists.newLinkedList();
|
||||
private Set<String> interfaces = Sets.newHashSet();
|
||||
private String baseModProperties;
|
||||
|
||||
static enum AnnotationType
|
||||
@@ -59,11 +62,13 @@ public class ASMModParser
|
||||
}
|
||||
}
|
||||
|
||||
public void beginNewTypeName(String typeQName, int classVersion, String superClassQName)
|
||||
public void beginNewTypeName(String typeQName, int classVersion, String superClassQName, String[] interfaces)
|
||||
{
|
||||
this.asmType = Type.getObjectType(typeQName);
|
||||
this.classVersion = classVersion;
|
||||
this.asmSuperType = !Strings.isNullOrEmpty(superClassQName) ? Type.getObjectType(superClassQName) : null;
|
||||
for (String intf : interfaces)
|
||||
this.interfaces.add(intf);
|
||||
}
|
||||
|
||||
public void startClassAnnotation(String annotationName)
|
||||
@@ -146,6 +151,11 @@ public class ASMModParser
|
||||
{
|
||||
table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
|
||||
}
|
||||
|
||||
for (String intf : interfaces)
|
||||
{
|
||||
table.addASMData(candidate, intf, this.asmType.getInternalName(), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void addAnnotationArray(String name)
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ModClassVisitor extends ClassVisitor
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
|
||||
{
|
||||
discoverer.beginNewTypeName(name, version, superName);
|
||||
discoverer.beginNewTypeName(name, version, superName, interfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -109,7 +109,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP) args;
|
||||
NetworkDispatcher dispatcher = player == null ? null : player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
NetworkDispatcher dispatcher = player == null ? null : player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
return dispatcher == null ? ImmutableList.<NetworkDispatcher>of() : ImmutableList.of(dispatcher);
|
||||
}
|
||||
},
|
||||
@@ -130,7 +130,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
|
||||
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
|
||||
{
|
||||
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
if (dispatcher != null) builder.add(dispatcher);
|
||||
}
|
||||
return builder.build();
|
||||
@@ -160,7 +160,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||
{
|
||||
if (dimension == player.dimension)
|
||||
{
|
||||
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
// Null dispatchers may exist for fake players - skip them
|
||||
if (dispatcher != null) builder.add(dispatcher);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||
|
||||
if (d4 * d4 + d5 * d5 + d6 * d6 < tp.range * tp.range)
|
||||
{
|
||||
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
if (dispatcher != null) builder.add(dispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -189,13 +189,13 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
completeServerSideConnection(ConnectionType.MODDED);
|
||||
}
|
||||
// FORGE: sometimes the netqueue will tick while login is occurring, causing an NPE. We shouldn't tick until the connection is complete
|
||||
if (this.playerEntity.playerNetServerHandler != this) return;
|
||||
if (this.playerEntity.connection != this) return;
|
||||
super.update();
|
||||
}
|
||||
};
|
||||
this.netHandler = serverHandler;
|
||||
// NULL the play server here - we restore it further on. If not, there are packets sent before the login
|
||||
player.playerNetServerHandler = null;
|
||||
player.connection = null;
|
||||
// manually for the manager into the PLAY state, so we can send packets later
|
||||
this.manager.setConnectionState(EnumConnectionState.PLAY);
|
||||
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
|
||||
}
|
||||
}
|
||||
|
||||
EntityTracker.func_187254_a(entity, spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ);
|
||||
EntityTracker.updateServerPosition(entity, spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ);
|
||||
|
||||
EntityPlayerSP clientPlayer = FMLClientHandler.instance().getClientPlayerEntity();
|
||||
if (entity instanceof IThrowableEntity)
|
||||
|
||||
@@ -90,7 +90,7 @@ public class FMLNetworkHandler
|
||||
embeddedChannel.writeOutbound(openGui);
|
||||
entityPlayerMP.openContainer = remoteGuiContainer;
|
||||
entityPlayerMP.openContainer.windowId = windowId;
|
||||
entityPlayerMP.openContainer.onCraftGuiOpened(entityPlayerMP);
|
||||
entityPlayerMP.openContainer.addListener(entityPlayerMP);
|
||||
}
|
||||
}
|
||||
else if (entityPlayer instanceof FakePlayer)
|
||||
|
||||
@@ -22,8 +22,8 @@ import net.minecraft.entity.EntityList;
|
||||
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.BiomeGenBase.SpawnListEntry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
@@ -113,7 +113,6 @@ public class EntityRegistry
|
||||
|
||||
private static final EntityRegistry INSTANCE = new EntityRegistry();
|
||||
|
||||
private BitSet availableIndices;
|
||||
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
|
||||
private Map<String,ModContainer> entityNames = Maps.newHashMap();
|
||||
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
|
||||
@@ -125,12 +124,6 @@ public class EntityRegistry
|
||||
|
||||
private EntityRegistry()
|
||||
{
|
||||
availableIndices = new BitSet(256);
|
||||
availableIndices.set(1,255);
|
||||
for (Object id : EntityList.idToClassMapping.keySet())
|
||||
{
|
||||
availableIndices.clear((Integer)id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,11 +170,11 @@ public class EntityRegistry
|
||||
{
|
||||
entityClassRegistrations.put(entityClass, er);
|
||||
entityNames.put(entityName, mc);
|
||||
if (!EntityList.classToStringMapping.containsKey(entityClass))
|
||||
if (!EntityList.CLASS_TO_NAME.containsKey(entityClass))
|
||||
{
|
||||
String entityModName = String.format("%s.%s", mc.getModId(), entityName);
|
||||
EntityList.classToStringMapping.put(entityClass, entityModName);
|
||||
EntityList.stringToClassMapping.put(entityModName, entityClass);
|
||||
EntityList.CLASS_TO_NAME.put(entityClass, entityModName);
|
||||
EntityList.NAME_TO_CLASS.put(entityModName, entityClass);
|
||||
FMLLog.finer("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
|
||||
}
|
||||
else
|
||||
@@ -214,10 +207,10 @@ public class EntityRegistry
|
||||
|
||||
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
|
||||
{
|
||||
if (EntityList.classToStringMapping.containsKey(entityClass))
|
||||
if (EntityList.CLASS_TO_NAME.containsKey(entityClass))
|
||||
{
|
||||
String name = EntityList.classToStringMapping.get(entityClass);
|
||||
EntityList.entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
|
||||
String name = EntityList.CLASS_TO_NAME.get(entityClass);
|
||||
EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
|
||||
FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass);
|
||||
}
|
||||
else
|
||||
@@ -225,97 +218,6 @@ public class EntityRegistry
|
||||
FMLLog.fine("Failed registering entity egg %s (No entity found)", entityClass.getName());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used.
|
||||
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead.
|
||||
*
|
||||
* @param entityClass Class of the entity being registered
|
||||
* @param entityName Name for the entity being registered
|
||||
* @param id A globally unique ID for the entity
|
||||
*/
|
||||
@Deprecated
|
||||
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id)
|
||||
{
|
||||
if (EntityList.classToStringMapping.containsKey(entityClass))
|
||||
{
|
||||
ModContainer activeModContainer = Loader.instance().activeModContainer();
|
||||
String modId = "unknown";
|
||||
if (activeModContainer != null)
|
||||
{
|
||||
modId = activeModContainer.getModId();
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
|
||||
}
|
||||
FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
|
||||
return;
|
||||
}
|
||||
id = instance().validateAndClaimId(id);
|
||||
EntityList.addMapping(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers in the minecraft Entity ID list. This is generally not a good idea, and shouldn't be used.
|
||||
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean)} instead.
|
||||
* @param entityClass The class of the entity being registered
|
||||
* @param entityName The name of the entity being registered
|
||||
* @param id The globally unique ID of the entity
|
||||
* @param backgroundEggColour An RGB colour value for the spawn egg background colour
|
||||
* @param foregroundEggColour An RGB colour value for the spawn egg foreground colour
|
||||
*/
|
||||
@Deprecated
|
||||
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
|
||||
{
|
||||
if (EntityList.classToStringMapping.containsKey(entityClass))
|
||||
{
|
||||
ModContainer activeModContainer = Loader.instance().activeModContainer();
|
||||
String modId = "unknown";
|
||||
if (activeModContainer != null)
|
||||
{
|
||||
modId = activeModContainer.getModId();
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
|
||||
}
|
||||
FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
|
||||
return;
|
||||
}
|
||||
instance().validateAndClaimId(id);
|
||||
EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
|
||||
}
|
||||
|
||||
private int validateAndClaimId(int id)
|
||||
{
|
||||
// workaround for broken ML
|
||||
int realId = id;
|
||||
if (id < Byte.MIN_VALUE)
|
||||
{
|
||||
FMLLog.warning("Compensating for modloader out of range compensation by mod : entityId %d for mod %s is now %d", id, Loader.instance().activeModContainer().getModId(), realId);
|
||||
realId += 3000;
|
||||
}
|
||||
|
||||
if (realId < 0)
|
||||
{
|
||||
realId += Byte.MAX_VALUE;
|
||||
}
|
||||
try
|
||||
{
|
||||
UnsignedBytes.checkedCast(realId);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
FMLLog.log(Level.ERROR, "The entity ID %d for mod %s is not an unsigned byte and may not work", id, Loader.instance().activeModContainer().getModId());
|
||||
}
|
||||
|
||||
if (!availableIndices.get(realId))
|
||||
{
|
||||
FMLLog.severe("The mod %s has attempted to register an entity ID %d which is already reserved. This could cause severe problems", Loader.instance().activeModContainer().getModId(), id);
|
||||
}
|
||||
availableIndices.clear(realId);
|
||||
return realId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list
|
||||
@@ -326,12 +228,13 @@ public class EntityRegistry
|
||||
* @param typeOfCreature Type of spawn
|
||||
* @param biomes List of biomes
|
||||
*/
|
||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
|
||||
{
|
||||
for (BiomeGenBase biome : biomes)
|
||||
for (Biome biome : biomes)
|
||||
{
|
||||
List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature);
|
||||
|
||||
boolean found = false;
|
||||
for (SpawnListEntry entry : spawns)
|
||||
{
|
||||
//Adjusting an existing spawn entry
|
||||
@@ -340,11 +243,13 @@ public class EntityRegistry
|
||||
entry.itemWeight = weightedProb;
|
||||
entry.minGroupCount = min;
|
||||
entry.maxGroupCount = max;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
|
||||
if (!found)
|
||||
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,9 +263,9 @@ public class EntityRegistry
|
||||
* @param biomes List of biomes
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
|
||||
{
|
||||
Class <? extends Entity > entityClazz = EntityList.stringToClassMapping.get(entityName);
|
||||
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
|
||||
|
||||
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
||||
{
|
||||
@@ -374,9 +279,9 @@ public class EntityRegistry
|
||||
* @param typeOfCreature type of spawn
|
||||
* @param biomes Biomes to remove from
|
||||
*/
|
||||
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
||||
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, Biome... biomes)
|
||||
{
|
||||
for (BiomeGenBase biome : biomes)
|
||||
for (Biome biome : biomes)
|
||||
{
|
||||
Iterator<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature).iterator();
|
||||
|
||||
@@ -398,9 +303,9 @@ public class EntityRegistry
|
||||
* @param biomes Biomes to remove from
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
||||
public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, Biome... biomes)
|
||||
{
|
||||
Class <? extends Entity > entityClazz = EntityList.stringToClassMapping.get(entityName);
|
||||
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
|
||||
|
||||
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
||||
{
|
||||
@@ -408,23 +313,6 @@ public class EntityRegistry
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function to try and obtain a globally unique entity ID. Not useful as it requires syncing between
|
||||
* client and server. Use {@link #registerModEntity(Class, String, int, Object, int, int, boolean)} instead,
|
||||
* for a much better experience.
|
||||
* @return A theoretically globally unique ID
|
||||
*/
|
||||
@Deprecated
|
||||
public static int findGlobalUniqueEntityId()
|
||||
{
|
||||
int res = instance().availableIndices.nextSetBit(0);
|
||||
if (res < 0)
|
||||
{
|
||||
throw new RuntimeException("No more entity indices left");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public EntityRegistration lookupModSpawn(Class<? extends Entity> clazz, boolean keepLooking)
|
||||
{
|
||||
Class<?> localClazz = clazz;
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class FMLControlledNamespacedRegistry<I extends IForgeRegistryEntry<I>> e
|
||||
this.dummiedLocations.clear();
|
||||
this.dummiedLocations.addAll(otherRegistry.dummiedLocations);
|
||||
|
||||
underlyingIntegerMap.func_186812_a();
|
||||
underlyingIntegerMap.clear();
|
||||
registryObjects.clear();
|
||||
|
||||
for (I thing : otherRegistry.typeSafeIterable())
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ public class ForgeRegistries
|
||||
public static final IForgeRegistry<Block> BLOCKS = GameRegistry.findRegistry(Block.class);
|
||||
public static final IForgeRegistry<Item> ITEMS = GameRegistry.findRegistry(Item.class);
|
||||
public static final IForgeRegistry<Potion> POTIONS = GameRegistry.findRegistry(Potion.class);
|
||||
public static final IForgeRegistry<BiomeGenBase> BIOMES = GameRegistry.findRegistry(BiomeGenBase.class);
|
||||
public static final IForgeRegistry<Biome> BIOMES = GameRegistry.findRegistry(Biome.class);
|
||||
public static final IForgeRegistry<SoundEvent> SOUND_EVENTS = GameRegistry.findRegistry(SoundEvent.class);
|
||||
public static final IForgeRegistry<PotionType> POTION_TYPES = GameRegistry.findRegistry(PotionType.class);
|
||||
public static final IForgeRegistry<Enchantment> ENCHANTMENTS = GameRegistry.findRegistry(Enchantment.class);
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.util.ObjectIntIdentityMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.registry.RegistryNamespaced;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
@@ -49,7 +49,7 @@ public class GameData
|
||||
private static final int MIN_POTIONTYPE_ID = 0; // Int
|
||||
private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // Int (SPacketEffect)
|
||||
private static final int MIN_ENCHANTMENT_ID = 0; // Int
|
||||
private static final int MAX_ENCHANTMENT_ID = Integer.MAX_VALUE >> 5; // Int - not serialized as an ID?
|
||||
private static final int MAX_ENCHANTMENT_ID = Short.MAX_VALUE - 1; // Short - serialized as a short in ItemStack NBTs.
|
||||
|
||||
private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap");
|
||||
private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid");
|
||||
@@ -61,7 +61,7 @@ public class GameData
|
||||
iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MIN_BLOCK_ID, MAX_BLOCK_ID, true, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE);
|
||||
iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MIN_ITEM_ID, MAX_ITEM_ID, true, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE);
|
||||
iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MIN_POTION_ID, MAX_POTION_ID, false, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE);
|
||||
iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, BiomeGenBase.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE);
|
||||
iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, Biome.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE);
|
||||
iSoundEventRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.SOUNDEVENTS, SoundEvent.class, null, MIN_SOUND_ID, MAX_SOUND_ID, false, null, null, null);
|
||||
ResourceLocation WATER = new ResourceLocation("water");
|
||||
iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null);
|
||||
@@ -71,7 +71,7 @@ public class GameData
|
||||
private final FMLControlledNamespacedRegistry<Block> iBlockRegistry;
|
||||
private final FMLControlledNamespacedRegistry<Item> iItemRegistry;
|
||||
private final FMLControlledNamespacedRegistry<Potion> iPotionRegistry;
|
||||
private final FMLControlledNamespacedRegistry<BiomeGenBase> iBiomeRegistry;
|
||||
private final FMLControlledNamespacedRegistry<Biome> iBiomeRegistry;
|
||||
private final FMLControlledNamespacedRegistry<SoundEvent> iSoundEventRegistry;
|
||||
private final FMLControlledNamespacedRegistry<PotionType> iPotionTypeRegistry;
|
||||
private final FMLControlledNamespacedRegistry<Enchantment> iEnchantmentRegistry;
|
||||
@@ -98,7 +98,7 @@ public class GameData
|
||||
|
||||
/** INTERNAL ONLY */
|
||||
@Deprecated
|
||||
public static FMLControlledNamespacedRegistry<BiomeGenBase> getBiomeRegistry() { return getMain().iBiomeRegistry; }
|
||||
public static FMLControlledNamespacedRegistry<Biome> getBiomeRegistry() { return getMain().iBiomeRegistry; }
|
||||
|
||||
/** INTERNAL ONLY */
|
||||
@Deprecated
|
||||
@@ -356,12 +356,12 @@ public class GameData
|
||||
// no op for the minute?
|
||||
}
|
||||
}
|
||||
private static class BiomeCallbacks implements IForgeRegistry.AddCallback<BiomeGenBase>,IForgeRegistry.ClearCallback<BiomeGenBase>,IForgeRegistry.CreateCallback<BiomeGenBase>
|
||||
private static class BiomeCallbacks implements IForgeRegistry.AddCallback<Biome>,IForgeRegistry.ClearCallback<Biome>,IForgeRegistry.CreateCallback<Biome>
|
||||
{
|
||||
static final BiomeCallbacks INSTANCE = new BiomeCallbacks();
|
||||
|
||||
@Override
|
||||
public void onAdd(BiomeGenBase potion, int id, Map<ResourceLocation, ?> slaves) {
|
||||
public void onAdd(Biome potion, int id, Map<ResourceLocation, ?> slaves) {
|
||||
// no op for the minute?
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class ObjectHolderRef {
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceLocation tmp = isBlock ? GameData.getBlockRegistry().getNameForObject((Block)existing) :
|
||||
isItem ? GameData.getItemRegistry().getNameForObject((Item)existing) : null;
|
||||
ResourceLocation tmp = isBlock ? ForgeRegistries.BLOCKS.getKey((Block)existing) :
|
||||
isItem ? ForgeRegistries.ITEMS.getKey((Item)existing) : null;
|
||||
this.injectedObject = tmp;
|
||||
}
|
||||
} catch (Exception e)
|
||||
@@ -104,15 +104,15 @@ class ObjectHolderRef {
|
||||
Object thing;
|
||||
if (isBlock)
|
||||
{
|
||||
thing = GameData.getBlockRegistry().getObject(injectedObject);
|
||||
if (thing == Blocks.air)
|
||||
thing = ForgeRegistries.BLOCKS.getValue(injectedObject);
|
||||
if (thing == Blocks.AIR)
|
||||
{
|
||||
thing = null;
|
||||
}
|
||||
}
|
||||
else if (isItem)
|
||||
{
|
||||
thing = GameData.getItemRegistry().getObject(injectedObject);
|
||||
thing = ForgeRegistries.ITEMS.getValue(injectedObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ public enum ObjectHolderRegistry {
|
||||
{
|
||||
try
|
||||
{
|
||||
clazz = Class.forName(className, true, getClass().getClassLoader());
|
||||
clazz = Class.forName(className, extractFromValue, getClass().getClassLoader());
|
||||
classCache.put(className, clazz);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -336,196 +336,6 @@ public class VillagerRegistry
|
||||
//This field is moved from EntityVillager over to here.
|
||||
//Moved to inner class to stop static initializer issues.
|
||||
//It is nasty I know but it's vanilla.
|
||||
private static final ITradeList[][][][] trades =
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.wheat, new PriceInfo(18, 22)),
|
||||
new EmeraldForItems(Items.potato, new PriceInfo(15, 19)),
|
||||
new EmeraldForItems(Items.carrot, new PriceInfo(15, 19)),
|
||||
new ListItemForEmeralds(Items.bread, new PriceInfo(-4, -2))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new PriceInfo(8, 13)),
|
||||
new ListItemForEmeralds(Items.pumpkin_pie, new PriceInfo(-3, -2))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new PriceInfo(7, 12)),
|
||||
new ListItemForEmeralds(Items.apple, new PriceInfo(-5, -7))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.cookie, new PriceInfo(-6, -10)),
|
||||
new ListItemForEmeralds(Items.cake, new PriceInfo(1, 1))
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.string, new PriceInfo(15, 20)),
|
||||
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
|
||||
new ItemAndEmeraldToItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, new PriceInfo(6, 6))
|
||||
},
|
||||
{
|
||||
new ListEnchantedItemForEmeralds(Items.fishing_rod, new PriceInfo(7, 8))
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)),
|
||||
new ListItemForEmeralds(Items.shears, new PriceInfo(3, 4))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 0), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 1), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 2), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 3), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 4), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 5), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 6), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 7), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 8), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 9), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 10), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 11), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 12), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 13), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 14), new PriceInfo(1, 2)),
|
||||
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 15), new PriceInfo(1, 2))
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.string, new PriceInfo(15, 20)),
|
||||
new ListItemForEmeralds(Items.arrow, new PriceInfo(-12, -8))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.bow, new PriceInfo(2, 3)),
|
||||
new ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new PriceInfo(10, 10), Items.flint, new PriceInfo(6, 10))
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.paper, new PriceInfo(24, 36)),
|
||||
new ListEnchantedBookForEmeralds()
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.book, new PriceInfo(8, 10)),
|
||||
new ListItemForEmeralds(Items.compass, new PriceInfo(10, 12)),
|
||||
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.written_book, new PriceInfo(2, 2)),
|
||||
new ListItemForEmeralds(Items.clock, new PriceInfo(10, 12)),
|
||||
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3))
|
||||
},
|
||||
{
|
||||
new ListEnchantedBookForEmeralds()
|
||||
},
|
||||
{
|
||||
new ListEnchantedBookForEmeralds()
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.name_tag, new PriceInfo(20, 22))
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.rotten_flesh, new PriceInfo(36, 40)),
|
||||
new EmeraldForItems(Items.gold_ingot, new PriceInfo(8, 10))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)),
|
||||
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new PriceInfo(-2, -1))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.ender_pearl, new PriceInfo(4, 7)),
|
||||
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.experience_bottle, new PriceInfo(3, 11))
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
|
||||
new ListItemForEmeralds(Items.iron_helmet, new PriceInfo(4, 6))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
|
||||
new ListItemForEmeralds(Items.iron_chestplate, new PriceInfo(10, 14))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
|
||||
new ListEnchantedItemForEmeralds(Items.diamond_chestplate, new PriceInfo(16, 19))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.chainmail_boots, new PriceInfo(5, 7)),
|
||||
new ListItemForEmeralds(Items.chainmail_leggings, new PriceInfo(9, 11)),
|
||||
new ListItemForEmeralds(Items.chainmail_helmet, new PriceInfo(5, 7)),
|
||||
new ListItemForEmeralds(Items.chainmail_chestplate, new PriceInfo(11, 15))
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
|
||||
new ListItemForEmeralds(Items.iron_axe, new PriceInfo(6, 8))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
|
||||
new ListEnchantedItemForEmeralds(Items.iron_sword, new PriceInfo(9, 10))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
|
||||
new ListEnchantedItemForEmeralds(Items.diamond_sword, new PriceInfo(12, 15)),
|
||||
new ListEnchantedItemForEmeralds(Items.diamond_axe, new PriceInfo(9, 12))
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
|
||||
new ListEnchantedItemForEmeralds(Items.iron_shovel, new PriceInfo(5, 7))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
|
||||
new ListEnchantedItemForEmeralds(Items.iron_pickaxe, new PriceInfo(9, 11))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
|
||||
new ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new PriceInfo(12, 15))
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.porkchop, new PriceInfo(14, 18)),
|
||||
new EmeraldForItems(Items.chicken, new PriceInfo(14, 18))
|
||||
},
|
||||
{
|
||||
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
|
||||
new ListItemForEmeralds(Items.cooked_porkchop, new PriceInfo(-7, -5)),
|
||||
new ListItemForEmeralds(Items.cooked_chicken, new PriceInfo(-8, -6))
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
new EmeraldForItems(Items.leather, new PriceInfo(9, 12)),
|
||||
new ListItemForEmeralds(Items.leather_leggings, new PriceInfo(2, 4))
|
||||
},
|
||||
{
|
||||
new ListEnchantedItemForEmeralds(Items.leather_chestplate, new PriceInfo(7, 12))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.saddle, new PriceInfo(8, 10))
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
private static final ITradeList[][][][] trades = EntityVillager.GET_TRADES_DONT_USE();
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,13 @@ import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import net.minecraft.command.ServerCommand;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.server.dedicated.PendingCommand;
|
||||
import net.minecraft.util.IThreadListener;
|
||||
import net.minecraft.util.text.translation.LanguageMap;
|
||||
import net.minecraft.world.storage.SaveFormatOld;
|
||||
@@ -183,7 +183,7 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||
// rudimentary command processing, check for fml confirm/cancel and stop commands
|
||||
synchronized (dedServer.pendingCommandList)
|
||||
{
|
||||
for (Iterator<ServerCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, ServerCommand.class).iterator(); it.hasNext(); )
|
||||
for (Iterator<PendingCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, PendingCommand.class).iterator(); it.hasNext(); )
|
||||
{
|
||||
String cmd = it.next().command.trim().toLowerCase();
|
||||
|
||||
|
||||
Reference in new issue
Block a user