Initial commit (Forge 1291).
This commit is contained in:
58
patches/cpw/mods/fml/common/FMLCommonHandler.java.patch
Normal file
58
patches/cpw/mods/fml/common/FMLCommonHandler.java.patch
Normal file
@ -0,0 +1,58 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
|
||||
@@ -37,6 +37,10 @@
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
@@ -385,10 +389,11 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
- if (handlerSet.contains(handler))
|
||||
+ if (handlerSet.contains(handler) || worldInfo.getDimension() != 0) // Cauldron - Only check FML data in main world
|
||||
{
|
||||
return;
|
||||
}
|
||||
+ // Cauldron - logic below should only be run for overworld as Forge/Vanilla only use 1 SaveHandler
|
||||
handlerSet.add(handler);
|
||||
handlerToCheck = new WeakReference<SaveHandler>(handler); // for confirmBackupLevelDatUse
|
||||
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
|
||||
@@ -496,7 +501,12 @@
|
||||
|
||||
public String getModName()
|
||||
{
|
||||
- List<String> modNames = Lists.newArrayListWithExpectedSize(3);
|
||||
+ // Cauldron start
|
||||
+ List<String> modNames = Lists.newArrayListWithExpectedSize(6);
|
||||
+ modNames.add("cauldron");
|
||||
+ modNames.add("craftbukkit");
|
||||
+ modNames.add("mcpc");
|
||||
+ // Cauldron end
|
||||
modNames.add("fml");
|
||||
if (!noForge)
|
||||
{
|
||||
@@ -540,8 +550,17 @@
|
||||
bus().post(new InputEvent.KeyInputEvent());
|
||||
}
|
||||
|
||||
+ // Cauldron start - wrapper to notify plugins for mods that bypass ServerConfigurationManager
|
||||
public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)
|
||||
{
|
||||
+ this.firePlayerChangedDimensionEvent(player, fromDim, toDim, player.worldObj.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim, CraftWorld fromWorld)
|
||||
+ {
|
||||
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) player.getBukkitEntity(), fromWorld);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ // Cauldron end
|
||||
bus().post(new PlayerEvent.PlayerChangedDimensionEvent(player, fromDim, toDim));
|
||||
}
|
||||
|
17
patches/cpw/mods/fml/common/asm/FMLSanityChecker.java.patch
Normal file
17
patches/cpw/mods/fml/common/asm/FMLSanityChecker.java.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/asm/FMLSanityChecker.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/asm/FMLSanityChecker.java
|
||||
@@ -164,10 +164,12 @@
|
||||
FMLRelaunchLog.severe("Technical information: ClientBrandRetriever was at %s, there were %d certificates for it", codeSource.getLocation(), certCount);
|
||||
}
|
||||
}
|
||||
- if (!goodFML)
|
||||
+ // Cauldron start - disable message
|
||||
+ /*if (!goodFML)
|
||||
{
|
||||
FMLRelaunchLog.severe("FML appears to be missing any signature data. This is not a good thing");
|
||||
- }
|
||||
+ }*/
|
||||
+ // Cauldron end
|
||||
return null;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/asm/transformers/SideTransformer.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/asm/transformers/SideTransformer.java
|
||||
@@ -32,6 +32,7 @@
|
||||
{
|
||||
private static String SIDE = FMLLaunchHandler.side().name();
|
||||
private static final boolean DEBUG = false;
|
||||
+ public static boolean allowInvalidSide = false; // Cauldron
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] bytes)
|
||||
{
|
||||
@@ -41,7 +42,7 @@
|
||||
ClassReader classReader = new ClassReader(bytes);
|
||||
classReader.accept(classNode, 0);
|
||||
|
||||
- if (remove((List<AnnotationNode>)classNode.visibleAnnotations, SIDE))
|
||||
+ if (remove((List<AnnotationNode>)classNode.visibleAnnotations, SIDE) && !allowInvalidSide) // Cauldron
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
@ -0,0 +1,23 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/event/FMLServerStartingEvent.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/event/FMLServerStartingEvent.java
|
||||
@@ -16,6 +16,7 @@
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import cpw.mods.fml.common.LoaderState.ModState;
|
||||
+import org.bukkit.command.Command; // Cauldron
|
||||
|
||||
public class FMLServerStartingEvent extends FMLStateEvent
|
||||
{
|
||||
@@ -43,4 +44,12 @@
|
||||
CommandHandler ch = (CommandHandler) getServer().getCommandManager();
|
||||
ch.registerCommand(command);
|
||||
}
|
||||
+
|
||||
+ // Cauldron start - used for mods to register a Bukkit command
|
||||
+ public void registerServerCommand(String fallbackPrefix, Command command)
|
||||
+ {
|
||||
+ org.bukkit.command.SimpleCommandMap commandMap = getServer().server.getCommandMap();
|
||||
+ commandMap.register(fallbackPrefix, command);
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/network/handshake/ChannelRegistrationHandler.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/network/handshake/ChannelRegistrationHandler.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
+
|
||||
+import java.io.UnsupportedEncodingException;
|
||||
import java.util.Set;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import org.apache.logging.log4j.Level;
|
||||
@@ -24,6 +26,23 @@
|
||||
msg.payload().readBytes(data);
|
||||
String channels = new String(data,Charsets.UTF_8);
|
||||
String[] split = channels.split("\0");
|
||||
+ // Cauldron start - register bukkit channels for players
|
||||
+ NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||
+ if (msg.channel().equals("REGISTER"))
|
||||
+ {
|
||||
+ for (String channel : split)
|
||||
+ {
|
||||
+ dispatcher.player.getBukkitEntity().addChannel(channel);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ for (String channel : split)
|
||||
+ {
|
||||
+ dispatcher.player.getBukkitEntity().removeChannel(channel);
|
||||
+ }
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
Set<String> channelSet = ImmutableSet.copyOf(split);
|
||||
FMLCommonHandler.instance().fireNetRegistrationEvent(manager, channelSet, msg.channel(), side);
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java
|
||||
@@ -72,7 +72,7 @@
|
||||
public static final AttributeKey<Boolean> IS_LOCAL = new AttributeKey<Boolean>("fml:isLocal");
|
||||
public final NetworkManager manager;
|
||||
private final ServerConfigurationManager scm;
|
||||
- private EntityPlayerMP player;
|
||||
+ public EntityPlayerMP player; // Cauldron
|
||||
private ConnectionState state;
|
||||
private ConnectionType connectionType;
|
||||
private final Side side;
|
||||
@@ -202,7 +202,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName());
|
||||
+ //FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName()); // Cauldron - unneeded spam
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -287,6 +287,7 @@
|
||||
state = ConnectionState.HANDSHAKING;
|
||||
}
|
||||
String channelName = msg.func_149559_c();
|
||||
+ player.getBukkitEntity().addChannel(channelName); // Cauldron - register channel for bukkit player
|
||||
if ("FML|HS".equals(channelName) || "REGISTER".equals(channelName) || "UNREGISTER".equals(channelName))
|
||||
{
|
||||
FMLProxyPacket proxy = new FMLProxyPacket(msg);
|
||||
@@ -308,6 +309,7 @@
|
||||
else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.SERVER))
|
||||
{
|
||||
FMLProxyPacket proxy = new FMLProxyPacket(msg);
|
||||
+ serverHandler.getCraftServer().getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), msg.func_149559_c(), msg.func_149558_e()); // pass msg to bukkit
|
||||
proxy.setDispatcher(this);
|
||||
context.fireChannelRead(proxy);
|
||||
return true;
|
||||
@@ -465,7 +467,7 @@
|
||||
// Stop the epic channel closed spam at close
|
||||
if (!(cause instanceof ClosedChannelException))
|
||||
{
|
||||
- FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception");
|
||||
+ //FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception"); // Cauldron - disable unneeded spam
|
||||
}
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/FMLNetworkHandler.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/FMLNetworkHandler.java
|
||||
@@ -47,6 +47,16 @@
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+//Cauldron start
|
||||
+import net.minecraft.inventory.IInventory;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.tileentity.TileEntity;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
+import org.bukkit.event.inventory.InventoryType;
|
||||
+// Cauldron end
|
||||
|
||||
public class FMLNetworkHandler
|
||||
{
|
||||
@@ -75,6 +85,31 @@
|
||||
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
|
||||
if (remoteGuiContainer != null)
|
||||
{
|
||||
+ // Cauldron start - create bukkitView for passed container then fire open event.
|
||||
+ if (entityPlayer != null)
|
||||
+ {
|
||||
+ if (remoteGuiContainer.getBukkitView() == null)
|
||||
+ {
|
||||
+ TileEntity te = entityPlayer.worldObj.getTileEntity(x, y, z);
|
||||
+ if (te != null && te instanceof IInventory)
|
||||
+ {
|
||||
+ IInventory teInv = (IInventory)te;
|
||||
+ CraftInventory inventory = new CraftInventory(teInv);
|
||||
+ remoteGuiContainer.bukkitView = new CraftInventoryView(entityPlayer.getBukkitEntity(), inventory, remoteGuiContainer);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ remoteGuiContainer.bukkitView = new CraftInventoryView(entityPlayer.getBukkitEntity(), MinecraftServer.getServer().server.createInventory(entityPlayer.getBukkitEntity(), InventoryType.CHEST), remoteGuiContainer);
|
||||
+ }
|
||||
+
|
||||
+ remoteGuiContainer = CraftEventFactory.callInventoryOpenEvent((EntityPlayerMP)entityPlayer, remoteGuiContainer, false);
|
||||
+ if (remoteGuiContainer == null)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
entityPlayerMP.getNextWindowId();
|
||||
entityPlayerMP.closeContainer();
|
||||
int windowId = entityPlayerMP.currentWindowId;
|
@ -0,0 +1,18 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
|
||||
@@ -13,9 +13,15 @@
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception
|
||||
{
|
||||
+ // Cauldron start - attempt to fix race condition with attr being null
|
||||
+ Object attr = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER);
|
||||
+ if (attr != null)
|
||||
+ {
|
||||
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove();
|
||||
dispatcher.completeHandshake(msg.target);
|
||||
}
|
||||
+ // Cauldron end
|
||||
+ }
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
|
@ -0,0 +1,79 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/registry/EntityRegistry.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/EntityRegistry.java
|
||||
@@ -41,6 +41,12 @@
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
|
||||
|
||||
+// Cauldron start
|
||||
+import net.minecraftforge.common.util.EnumHelper;
|
||||
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+// Cauldron end
|
||||
+
|
||||
public class EntityRegistry
|
||||
{
|
||||
public class EntityRegistration
|
||||
@@ -118,6 +124,8 @@
|
||||
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
|
||||
private Map<String,ModContainer> entityNames = Maps.newHashMap();
|
||||
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
|
||||
+ public static Map<Class <? extends Entity>, String> entityTypeMap = Maps.newHashMap(); // Cauldron - used by CraftCustomEntity
|
||||
+ public static Map<String, Class <? extends Entity>> entityClassMap = Maps.newHashMap(); // Cauldron - used by CraftWorld
|
||||
public static EntityRegistry instance()
|
||||
{
|
||||
return INSTANCE;
|
||||
@@ -147,6 +155,7 @@
|
||||
public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
||||
{
|
||||
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
||||
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -197,6 +206,7 @@
|
||||
}
|
||||
id = instance().validateAndClaimId(id);
|
||||
EntityList.addMapping(entityClass, entityName, id);
|
||||
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
|
||||
}
|
||||
|
||||
private int validateAndClaimId(int id)
|
||||
@@ -249,8 +259,38 @@
|
||||
}
|
||||
instance().validateAndClaimId(id);
|
||||
EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
|
||||
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
|
||||
}
|
||||
|
||||
+ // Cauldron start
|
||||
+ private static void registerBukkitType(Class <? extends Entity > entityClass, String entityName)
|
||||
+ {
|
||||
+ ModContainer activeModContainer = Loader.instance().activeModContainer();
|
||||
+ String modId = "unknown";
|
||||
+ // fixup bad entity names from mods
|
||||
+ if (entityName.contains("."))
|
||||
+ {
|
||||
+ if ((entityName.indexOf(".") + 1) < entityName.length())
|
||||
+ entityName = entityName.substring(entityName.indexOf(".") + 1, entityName.length());
|
||||
+ }
|
||||
+ entityName.replace("entity", "");
|
||||
+ if (entityName.startsWith("ent"))
|
||||
+ entityName.replace("ent", "");
|
||||
+ entityName = entityName.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric
|
||||
+ if (activeModContainer != null)
|
||||
+ modId = activeModContainer.getModId();
|
||||
+ entityName = modId + "-" + entityName;
|
||||
+ entityTypeMap.put(entityClass, entityName);
|
||||
+ entityClassMap.put(entityName, entityClass);
|
||||
+ }
|
||||
+
|
||||
+ // used by CraftCustomEntity
|
||||
+ public static String getCustomEntityTypeName(Class <? extends Entity > entityClass)
|
||||
+ {
|
||||
+ return entityTypeMap.get(entityClass);
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
+
|
||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
||||
{
|
||||
for (BiomeGenBase biome : biomes)
|
69
patches/cpw/mods/fml/common/registry/GameData.java.patch
Normal file
69
patches/cpw/mods/fml/common/registry/GameData.java.patch
Normal file
@ -0,0 +1,69 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/registry/GameData.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/GameData.java
|
||||
@@ -14,7 +14,9 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
+import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -1024,4 +1026,56 @@
|
||||
throw new RuntimeException("WHAT?");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Cauldron start
|
||||
+ public static void injectItemBukkitMaterials()
|
||||
+ {
|
||||
+ FMLControlledNamespacedRegistry<Item> itemRegistry = getItemRegistry();
|
||||
+ List<Integer> ids = new ArrayList<Integer>();
|
||||
+
|
||||
+ for (Item thing : itemRegistry.typeSafeIterable())
|
||||
+ {
|
||||
+ ids.add(itemRegistry.getId(thing));
|
||||
+ }
|
||||
+
|
||||
+ // sort by id
|
||||
+ Collections.sort(ids);
|
||||
+
|
||||
+ for (int id : ids)
|
||||
+ {
|
||||
+ Item item = itemRegistry.getRaw(id);
|
||||
+ // inject item materials into Bukkit for FML
|
||||
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(id, itemRegistry.getNameForObject(item), false);
|
||||
+ if (material != null)
|
||||
+ {
|
||||
+ FMLLog.info("Injected new Forge item material %s with ID %d.", material.name(), material.getId());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void injectBlockBukkitMaterials()
|
||||
+ {
|
||||
+ FMLControlledNamespacedRegistry<Block> blockRegistry = getBlockRegistry();
|
||||
+ List<Integer> ids = new ArrayList<Integer>();
|
||||
+
|
||||
+ for (Block block : blockRegistry.typeSafeIterable())
|
||||
+ {
|
||||
+ ids.add(blockRegistry.getId(block));
|
||||
+ }
|
||||
+
|
||||
+ // sort by id
|
||||
+ Collections.sort(ids);
|
||||
+
|
||||
+ for (int id : ids)
|
||||
+ {
|
||||
+ Block block = blockRegistry.getRaw(id);
|
||||
+ // inject block materials into Bukkit for FML
|
||||
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(id, blockRegistry.getNameForObject(block), true);
|
||||
+ if (material != null)
|
||||
+ {
|
||||
+ FMLLog.info("Injected new Forge block material %s with ID %d.", material.name(), material.getId());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
}
|
71
patches/cpw/mods/fml/common/registry/GameRegistry.java.patch
Normal file
71
patches/cpw/mods/fml/common/registry/GameRegistry.java.patch
Normal file
@ -0,0 +1,71 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/common/registry/GameRegistry.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/GameRegistry.java
|
||||
@@ -53,6 +53,7 @@
|
||||
import cpw.mods.fml.common.LoaderException;
|
||||
import cpw.mods.fml.common.LoaderState;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
+import java.util.HashMap; // Cauldron
|
||||
|
||||
public class GameRegistry
|
||||
{
|
||||
@@ -60,6 +61,10 @@
|
||||
private static Map<IWorldGenerator, Integer> worldGeneratorIndex = Maps.newHashMap();
|
||||
private static List<IFuelHandler> fuelHandlers = Lists.newArrayList();
|
||||
private static List<IWorldGenerator> sortedGeneratorList;
|
||||
+ // Cauldron start
|
||||
+ private static Map<String, Boolean> configWorldGenCache = new HashMap<String, Boolean>();
|
||||
+ private static Map<String, String> worldGenMap = new HashMap<String, String>();
|
||||
+ // Cauldron end
|
||||
|
||||
/**
|
||||
* Register a world generator - something that inserts new block types into the world
|
||||
@@ -70,12 +75,18 @@
|
||||
*/
|
||||
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight)
|
||||
{
|
||||
+ // Cauldron start - mod id's are not available during generateWorld so we must capture them here
|
||||
+ String modId = Loader.instance().activeModContainer().getModId();
|
||||
+ modId = modId.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric
|
||||
+ modId.replace(" ", "_");
|
||||
worldGenerators.add(generator);
|
||||
worldGeneratorIndex.put(generator, modGenerationWeight);
|
||||
if (sortedGeneratorList != null)
|
||||
{
|
||||
sortedGeneratorList = null;
|
||||
}
|
||||
+ worldGenMap.put(generator.getClass().getName(), modId);
|
||||
+ // Cauldron end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,11 +111,27 @@
|
||||
long zSeed = fmlRandom.nextLong() >> 2 + 1L;
|
||||
long chunkSeed = (xSeed * chunkX + zSeed * chunkZ) ^ worldSeed;
|
||||
|
||||
- for (IWorldGenerator generator : sortedGeneratorList)
|
||||
+ boolean before = ((net.minecraft.world.WorldServer) world).theChunkProviderServer.loadChunkOnProvideRequest; // Cauldron store value
|
||||
+ ((net.minecraft.world.WorldServer) world).theChunkProviderServer.loadChunkOnProvideRequest = true; // Cauldron load chunks on provide requests
|
||||
+ for (IWorldGenerator generator : worldGenerators)
|
||||
{
|
||||
- fmlRandom.setSeed(chunkSeed);
|
||||
- generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
|
||||
+ // Cauldron start
|
||||
+ if (!configWorldGenCache.containsKey(generator.getClass().getName()))
|
||||
+ {
|
||||
+ String modId = worldGenMap.get(generator.getClass().getName());
|
||||
+ String generatorName = "";
|
||||
+ generatorName = modId + "-" + generator.getClass().getSimpleName();
|
||||
+ boolean generatorEnabled = world.cauldronConfig.getBoolean("worldgen-" + generatorName, true);
|
||||
+ configWorldGenCache.put(generator.getClass().getName(), generatorEnabled);
|
||||
+ }
|
||||
+ if (configWorldGenCache.get(generator.getClass().getName()))
|
||||
+ {
|
||||
+ fmlRandom.setSeed(chunkSeed);
|
||||
+ generator.generate(fmlRandom, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
|
||||
+ }
|
||||
}
|
||||
+ ((net.minecraft.world.WorldServer)world).theChunkProviderServer.loadChunkOnProvideRequest = before; // reset
|
||||
+ // Cauldron end
|
||||
}
|
||||
|
||||
private static void computeSortedGeneratorList()
|
47
patches/cpw/mods/fml/relauncher/CoreModManager.java.patch
Normal file
47
patches/cpw/mods/fml/relauncher/CoreModManager.java.patch
Normal file
@ -0,0 +1,47 @@
|
||||
--- ../src-base/minecraft/cpw/mods/fml/relauncher/CoreModManager.java
|
||||
+++ ../src-work/minecraft/cpw/mods/fml/relauncher/CoreModManager.java
|
||||
@@ -153,6 +153,9 @@
|
||||
|
||||
}
|
||||
|
||||
+ // Cauldron - group output of @MCVersion warnings
|
||||
+ private static List<String> noVersionAnnotationCoreMods = new ArrayList<String>();
|
||||
+
|
||||
public static void handleLaunch(File mcDir, LaunchClassLoader classLoader, FMLTweaker tweaker)
|
||||
{
|
||||
CoreModManager.mcDir = mcDir;
|
||||
@@ -212,7 +215,19 @@
|
||||
loadCoreMod(classLoader, coreModClassName, null);
|
||||
}
|
||||
discoverCoreMods(mcDir, classLoader);
|
||||
-
|
||||
+ // Cauldron start - group output of @MCVersion warnings
|
||||
+ if (!noVersionAnnotationCoreMods.isEmpty())
|
||||
+ {
|
||||
+ FMLRelaunchLog
|
||||
+ .warning("The following coremods do not have a @MCVersion annotation. They may cause problems if this is not the correct version of Minecraft for them.");
|
||||
+ StringBuilder sb = new StringBuilder("Missing @MCVersion: ");
|
||||
+ for (String className : noVersionAnnotationCoreMods)
|
||||
+ {
|
||||
+ sb.append(className).append(" ");
|
||||
+ }
|
||||
+ FMLRelaunchLog.warning(sb.toString());
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
}
|
||||
|
||||
private static void discoverCoreMods(File mcDir, LaunchClassLoader classLoader)
|
||||
@@ -424,8 +439,11 @@
|
||||
MCVersion requiredMCVersion = coreModClazz.getAnnotation(IFMLLoadingPlugin.MCVersion.class);
|
||||
if (!Arrays.asList(rootPlugins).contains(coreModClass) && (requiredMCVersion == null || Strings.isNullOrEmpty(requiredMCVersion.value())))
|
||||
{
|
||||
- FMLRelaunchLog.log(Level.WARN, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
|
||||
- coreModClass);
|
||||
+ // Cauldron start - group output of @MCVersion warnings
|
||||
+ // FMLRelaunchLog.log(Level.WARN, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft",
|
||||
+ // coreModClass);
|
||||
+ noVersionAnnotationCoreMods.add(coreModClass);
|
||||
+ // Cauldron end
|
||||
}
|
||||
else if (requiredMCVersion != null && !FMLInjectionData.mccversion.equals(requiredMCVersion.value()))
|
||||
{
|
Reference in New Issue
Block a user