Merge remote-tracking branch 'origin/master' into snapshot15 and fix patches

Conflicts:
	fml-src-1.4.7-4.7.22.539-master.zip
	fml-src-1.4.7-4.7.4.520-master.zip
	fml-src-13w02b-4.99.16.541-snapshot15.zip
	patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch
	patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch
	patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch
	patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch
	patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch
	patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch
	patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch
	patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch
	patches/minecraft/net/minecraft/world/World.java.patch
	patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch
	patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch
	patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureDesertPyramid.java.patch
This commit is contained in:
Christian 2013-01-22 17:28:28 -05:00
commit 78e192e28e
21 changed files with 387 additions and 261 deletions

View File

@ -194,7 +194,7 @@ public class Configuration
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
}
if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift > Block.blocksList.length)
if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length)
{
prop.value = Integer.toString(defaultID);
configMarkers[defaultShift] = true;

View File

@ -203,7 +203,6 @@ public class DimensionManager
/**
* Not public API: used internally to get dimensions that should load at
* server startup
* @return
*/
public static Integer[] getStaticDimensionIDs()
{
@ -256,7 +255,7 @@ public class DimensionManager
/**
* Return the next free dimension ID. Note: you are not guaranteed a contiguous
* block of free ids. Always call for each individual ID you wish to get.
* @return
* @return the next free dimension ID
*/
public static int getNextFreeDimId() {
int next = 0;
@ -318,8 +317,8 @@ public class DimensionManager
}
/**
* Return the current root directory for the world save. Accesses getSaveHandler from the
* @return
* Return the current root directory for the world save. Accesses getSaveHandler from the overworld
* @return the root directory of the save
*/
public static File getCurrentSaveRootDirectory()
{
@ -327,6 +326,12 @@ public class DimensionManager
{
return ((SaveHandler)DimensionManager.getWorld(0).getSaveHandler()).getSaveDirectory();
}
else if (MinecraftServer.getServer() != null)
{
MinecraftServer srv = MinecraftServer.getServer();
SaveHandler saveHandler = (SaveHandler) srv.getActiveAnvilConverter().getSaveLoader(srv.getFolderName(), false);
return saveHandler.getSaveDirectory();
}
else
{
return null;

View File

@ -291,7 +291,7 @@ public class ForgeChunkManager
/**
* Get the entity associated with this {@link Type#ENTITY} type ticket
* @return
* @return the entity
*/
public Entity getEntity()
{
@ -789,7 +789,7 @@ public class ForgeChunkManager
/**
* The list of persistent chunks in the world. This set is immutable.
* @param world
* @return
* @return the list of persistent chunks in the world
*/
public static ImmutableSetMultimap<ChunkCoordIntPair, Ticket> getPersistentChunksFor(World world)
{

View File

@ -6,6 +6,7 @@ import java.util.Map;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.management.PlayerInstance;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
@ -24,6 +25,8 @@ import static net.minecraftforge.common.ForgeVersion.*;
public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer
{
public static int clumpingThreshold;
public ForgeDummyContainer()
{
super(new ModMetadata());
@ -50,8 +53,16 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
{
Configuration.enableGlobalConfig();
}
config.save();
}
Property clumpingThresholdProperty = config.get(Configuration.CATEGORY_GENERAL, "clumpingThreshold", 64);
clumpingThresholdProperty.comment = "Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024";
clumpingThreshold = clumpingThresholdProperty.getInt(64);
if (clumpingThreshold > 1024 || clumpingThreshold < 64)
{
clumpingThreshold = 64;
clumpingThresholdProperty.value = "64";
}
config.save();
}
@Override

View File

@ -35,6 +35,8 @@ public class MinecraftForge
public static final EventBus ORE_GEN_BUS = new EventBus();
@Deprecated //Vanilla feature now
public static boolean SPAWNER_ALLOW_ON_INVERTED = false;
public static final int clumpingThreshold = ForgeDummyContainer.clumpingThreshold;
private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();

View File

@ -11,7 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
public interface IBlockLiquid extends ILiquid {
/**
* Controls the type of block that is generated by this IBlockLiquid
* @author cpw
*
*/
public enum BlockType {
@ -31,7 +30,7 @@ public interface IBlockLiquid extends ILiquid {
/**
* Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid.
* @return
* @return if this liquid will generate new sources
*/
public boolean willGenerateSources();
@ -47,12 +46,12 @@ public interface IBlockLiquid extends ILiquid {
/**
* Get the texture file for rendering the liquid
* @return
* @return the texture file for this liquid
*/
public String getLiquidBlockTextureFile();
/**
* Custom properties of the liquid.
* @return
* @return a compound tag of custom liquid properties
*/
public NBTTagCompound getLiquidProperties();

View File

@ -17,19 +17,19 @@ public interface ILiquid {
/**
* The itemId of the liquid item
* @return
* @return the itemId
*/
public int stillLiquidId();
/**
* Is this liquid a metadata based liquid
* @return
* @return if this is a metadata liquid
*/
public boolean isMetaSensitive();
/**
* The item metadata of the liquid
* @return
* @return the metadata of the liquid
*/
public int stillLiquidMeta();
}

View File

@ -14,7 +14,7 @@ public interface ITankContainer {
int fill(ForgeDirection from, LiquidStack resource, boolean doFill);
/**
* Fills liquid into the specified internal tank.
* @param from Orientation the liquid is pumped in from.
* @param tankIndex the index of the tank to fill
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
* @param doFill If false filling will only be simulated.
* @return Amount of resource that was filled into internal tanks.
@ -31,7 +31,7 @@ public interface ITankContainer {
LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
/**
* Drains liquid out of the specified internal tank.
* @param from Orientation the liquid is drained to.
* @param tankIndex the index of the tank to drain
* @param maxDrain Maximum amount of liquid to drain.
* @param doDrain If false draining will only be simulated.
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer

View File

@ -29,7 +29,7 @@ public abstract class LiquidDictionary
*
* @param name the name of the liquid
* @param liquid the liquid to use if one doesn't exist
* @return
* @return the matching liquid stack
*/
public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid)
{
@ -50,7 +50,7 @@ public abstract class LiquidDictionary
*
* @param name the name of the liquid
* @param amount the amout of liquid
* @return
* @return a liquidstack for the requested liquid
*/
public static LiquidStack getLiquid(String name, int amount)
{
@ -75,8 +75,6 @@ public abstract class LiquidDictionary
/**
* Fired when a new liquid is created
*
* @author cpw
*
*/
public static class LiquidRegisterEvent extends Event
{

View File

@ -90,7 +90,7 @@ public class LiquidStack
* Reads a liquid stack from the passed nbttagcompound and returns it.
*
* @param nbt
* @return
* @return the liquid stack
*/
public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbt)
{

View File

@ -18,3 +18,9 @@ ScotTools Background: ScotTools was an API that enabled modders to add blocks to
* LexManos *
* cpw *
* Minecraft Coder Pack (MCP) *
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically download components of MCP and distribute MCP data files.
This permission is not transitive and others wishing to redistribute the Minecraft Forge source independently should seek permission of MCP or
remove the MCP data files and request their users to download MCP separately.

View File

@ -63,3 +63,8 @@ minecraft original sources.
Modification of Minecraft Forge as well as dependencies, including patches to
minecraft original sources, has to remain under the terms of the present
license.
The right to distribute Minecraft Forge does not extend to the right to distribute
MCP data files included within Minecraft Forge. These are the property of the MCP
project and should be removed from any customized distribution of Minecraft Forge
or permission sought separately from the MCP team.

View File

@ -1,70 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/RailLogic.java
+++ ../src_work/minecraft/net/minecraft/block/RailLogic.java
@@ -20,6 +20,7 @@
private List connectedTracks;
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail par1BlockRail, World par2World, int par3, int par4, int par5)
{
@@ -30,18 +31,11 @@
this.trackY = par4;
this.trackZ = par5;
int l = par2World.getBlockId(par3, par4, par5);
- int i1 = par2World.getBlockMetadata(par3, par4, par5);
-
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l]))
- {
- this.isPoweredRail = true;
- i1 &= -9;
- }
- else
- {
- this.isPoweredRail = false;
- }
-
+
+ BlockRail target = (BlockRail)Block.blocksList[l];
+ int i1 = target.getBasicRailMetadata(par2World, null, par3, par4, par5);
+ isPoweredRail = !target.isFlexibleRail(par2World, par3, par4, par5);
+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5);
this.setConnections(i1);
}
@@ -260,7 +254,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -273,7 +267,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -424,7 +418,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -437,7 +431,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{

View File

@ -0,0 +1,20 @@
--- ../src_base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src_work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -375,7 +375,7 @@
}
else if (par1GuiButton.id == 8)
{
- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.field_82290_a));
+ WorldType.worldTypes[this.worldTypeId].onCustomizeButton(this.mc, this);
}
}
}
@@ -393,7 +393,7 @@
this.buttonBonusItems.drawButton = this.moreOptions;
this.buttonWorldType.drawButton = this.moreOptions;
this.buttonAllowCommands.drawButton = this.moreOptions;
- this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT;
+ this.buttonCustomize.drawButton = this.moreOptions && (WorldType.worldTypes[this.worldTypeId].isCustomizable());
StringTranslate stringtranslate;
if (this.moreOptions)

View File

@ -0,0 +1,19 @@
--- ../src_base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
+++ ../src_work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
@@ -13,6 +13,8 @@
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.EmptyChunk;
import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.ChunkEvent;
@SideOnly(Side.CLIENT)
public class ChunkProviderClient implements IChunkProvider
@@ -75,6 +77,7 @@
{
Chunk chunk = new Chunk(this.worldObj, par1, par2);
this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(par1, par2), chunk);
+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(chunk));
chunk.isChunkLoaded = true;
return chunk;
}

View File

@ -0,0 +1,19 @@
--- ../src_base/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java
+++ ../src_work/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java
@@ -6,6 +6,7 @@
import java.io.IOException;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.common.MinecraftForge;
public class Packet52MultiBlockChange extends Packet
{
@@ -38,7 +39,7 @@
try
{
- if (par4 >= 64)
+ if (par4 >= MinecraftForge.clumpingThreshold)
{
System.out.println("ChunkTilesUpdatePacket compress " + par4);

View File

@ -1,6 +1,14 @@
--- ../src_base/minecraft/net/minecraft/server/management/PlayerInstance.java
+++ ../src_work/minecraft/net/minecraft/server/management/PlayerInstance.java
@@ -10,9 +10,12 @@
@@ -1,6 +1,7 @@
package net.minecraft.server.management;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.packet.Packet;
@@ -10,9 +11,12 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkCoordIntPair;
@ -14,24 +22,96 @@
/** note: this is final */
private final ChunkCoordIntPair chunkLocation;
@@ -55,6 +58,8 @@
par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet51MapChunk(PlayerManager.getWorldServer(this.myManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), true, 0));
@@ -56,6 +60,8 @@
this.playersInChunk.remove(par1EntityPlayerMP);
par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation);
+
+ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP));
+ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP));
+
if (this.playersInChunk.isEmpty())
{
@@ -144,7 +149,10 @@
if ((this.field_73260_f & 1 << k) != 0)
{
l = k << 4;
- List list = PlayerManager.getWorldServer(this.myManager).getAllTileEntityInBox(i, l, j, i + 16, l + 16, j + 16);
+ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it.
+ //ToDo: Find a way to efficiently clean abandoned chunks.
+ //List list = PlayerManager.getWorldServer(this.myManager).getAllTileEntityInBox(i, l, j, i + 16, l + 16, j + 16);
+ List list = PlayerManager.getWorldServer(this.myManager).getAllTileEntityInBox(i, l, j, i + 15, l + 16, j + 15);
long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32;
@@ -80,20 +86,21 @@
for (int i1 = 0; i1 < list.size(); ++i1)
this.field_73260_f |= 1 << (par2 >> 4);
- if (this.numberOfTilesToUpdate < 64)
+ short var4 = (short)(par1 << 12 | par3 << 8 | par2);
+
+ for (int var5 = 0; var5 < this.numberOfTilesToUpdate; ++var5)
{
- short short1 = (short)(par1 << 12 | par3 << 8 | par2);
+ if (this.locationOfBlockChange[var5] == var4)
+ {
+ return;
+ }
+ }
- for (int l = 0; l < this.numberOfTilesToUpdate; ++l)
- {
- if (this.locationOfBlockChange[l] == short1)
- {
- return;
- }
- }
-
- this.locationOfBlockChange[this.numberOfTilesToUpdate++] = short1;
+ if (this.numberOfTilesToUpdate == locationOfBlockChange.length)
+ {
+ this.locationOfBlockChange = Arrays.copyOf(this.locationOfBlockChange, locationOfBlockChange.length << 1);
}
+ this.locationOfBlockChange[this.numberOfTilesToUpdate++] = var4;
}
public void sendToAllPlayersWatchingChunk(Packet par1Packet)
@@ -133,40 +140,26 @@
{
int l;
- if (this.numberOfTilesToUpdate == 64)
+ if (this.numberOfTilesToUpdate >= MinecraftForge.clumpingThreshold)
{
i = this.chunkLocation.chunkXPos * 16;
j = this.chunkLocation.chunkZPos * 16;
this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.myManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.field_73260_f));
-
- for (k = 0; k < 16; ++k)
- {
- if ((this.field_73260_f & 1 << k) != 0)
- {
- l = k << 4;
- List list = PlayerManager.getWorldServer(this.myManager).getAllTileEntityInBox(i, l, j, i + 16, l + 16, j + 16);
-
- for (int i1 = 0; i1 < list.size(); ++i1)
- {
- this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(i1));
- }
- }
- }
}
else
{
this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.myManager)));
+ }
- for (i = 0; i < this.numberOfTilesToUpdate; ++i)
+ for (i = 0; i < this.numberOfTilesToUpdate; ++i)
+ {
+ j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15);
+ k = this.locationOfBlockChange[i] & 255;
+ l = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[i] >> 8 & 15);
+
+ if (PlayerManager.getWorldServer(this.myManager).blockHasTileEntity(j, k, l))
{
- j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15);
- k = this.locationOfBlockChange[i] & 255;
- l = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[i] >> 8 & 15);
-
- if (PlayerManager.getWorldServer(this.myManager).blockHasTileEntity(j, k, l))
- {
- this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.myManager).getBlockTileEntity(j, k, l));
- }
+ this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.myManager).getBlockTileEntity(j, k, l));
}
}
}

View File

@ -1,6 +1,16 @@
--- ../src_base/minecraft/net/minecraft/world/WorldType.java
+++ ../src_work/minecraft/net/minecraft/world/WorldType.java
@@ -224,4 +224,14 @@
@@ -10,6 +10,9 @@
import com.google.common.collect.ObjectArrays;
import com.google.common.collect.Sets;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiCreateFlatWorld;
+import net.minecraft.client.gui.GuiCreateWorld;
import net.minecraft.world.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.biome.*;
@@ -224,4 +227,36 @@
* Called when 'Create New World' button is pressed before starting game
*/
public void onGUICreateWorldPress() { }
@ -13,5 +23,27 @@
+ public int getSpawnFuzz()
+ {
+ return 20;
+ }
+
+ /**
+ * Called when the 'Customize' button is pressed on world creation GUI
+ * @param instance The minecraft instance
+ * @param guiCreateWorld the createworld GUI
+ */
+ @SideOnly(Side.CLIENT)
+ public void onCustomizeButton(Minecraft instance, GuiCreateWorld guiCreateWorld) {
+ if (this == FLAT)
+ {
+ instance.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_82290_a));
+ }
+ }
+
+ /*
+ * Should world creation GUI show 'Customize' button for this world type?
+ * @return if this world type has customization parameters
+ */
+ public boolean isCustomizable()
+ {
+ return this == FLAT;
+ }
}