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

@ -25,7 +25,7 @@ public class ChestGenHooks
private static final HashMap<String, ChestGenHooks> chestInfo = new HashMap<String, ChestGenHooks>();
private static boolean hasInit = false;
static
static
{
init();
}
@ -52,7 +52,7 @@ public class ChestGenHooks
ItemStack book = new ItemStack(Item.enchantedBook, 1, 0);
WeightedRandomChestContent tmp = new WeightedRandomChestContent(book, 1, 1, 1);
getInfo(MINESHAFT_CORRIDOR ).addItem(tmp);
getInfo(PYRAMID_DESERT_CHEST).addItem(tmp);
getInfo(PYRAMID_DESERT_CHEST).addItem(tmp);
getInfo(PYRAMID_JUNGLE_CHEST).addItem(tmp);
getInfo(STRONGHOLD_CORRIDOR ).addItem(tmp);
getInfo(STRONGHOLD_LIBRARY ).addItem(new WeightedRandomChestContent(book, 1, 5, 2));
@ -77,7 +77,7 @@ public class ChestGenHooks
addDungeonLoot(d, new ItemStack(Item.dyePowder, 1, 3), 100, 1, 1);
addDungeonLoot(d, book, 100, 1, 1);
}
static void addDungeonLoot(ChestGenHooks dungeon, ItemStack item, int weight, int min, int max)
{
dungeon.addItem(new WeightedRandomChestContent(item, min, max, weight));
@ -90,7 +90,7 @@ public class ChestGenHooks
/**
* Retrieves, or creates the info class for the specified category.
*
*
* @param category The category name
* @return A instance of ChestGenHooks for the specified category.
*/
@ -105,14 +105,14 @@ public class ChestGenHooks
/**
* Generates an array of items based on the input min/max count.
* If the stack can not hold the total amount, it will be split into
* If the stack can not hold the total amount, it will be split into
* stacks of size 1.
*
*
* @param rand A random number generator
* @param source Source item stack
* @param min Minimum number of items
* @param max Maximum number of items
* @return An array containing the generated item stacks
* @return An array containing the generated item stacks
*/
public static ItemStack[] generateStacks(Random rand, ItemStack source, int min, int max)
{
@ -158,7 +158,7 @@ public class ChestGenHooks
{
this.category = category;
}
public ChestGenHooks(String category, WeightedRandomChestContent[] items, int min, int max)
{
this(category);
@ -169,21 +169,21 @@ public class ChestGenHooks
countMin = min;
countMax = max;
}
/**
* Adds a new entry into the possible items to generate.
*
*
* @param item The item to add.
*/
public void addItem(WeightedRandomChestContent item)
{
contents.add(item);
}
/**
* Removes all items that match the input item stack, Only metadata and item ID are checked.
* If the input item has a metadata of -1, all metadatas will match.
*
*
* @param item The item to check
*/
public void removeItem(ItemStack item)
@ -201,13 +201,13 @@ public class ChestGenHooks
/**
* Gets an array of all random objects that are associated with this category.
*
*
* @return The random objects
*/
public WeightedRandomChestContent[] getItems(Random rnd)
{
ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();
for (WeightedRandomChestContent orig : contents)
{
Item item = orig.theItemId.getItem();
@ -227,7 +227,7 @@ public class ChestGenHooks
/**
* Gets a random number between countMin and countMax.
*
*
* @param rand A RNG
* @return A random number where countMin <= num <= countMax
*/
@ -235,11 +235,11 @@ public class ChestGenHooks
{
return countMin < countMax ? countMin + rand.nextInt(countMax - countMin) : countMin;
}
/**
* Returns a single ItemStack from the possible items in this registry,
* Useful if you just want a quick and dirty random Item.
*
*
* @param rand A Random Number gen
* @return A single ItemStack, or null if it could not get one.
*/

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());
@ -40,7 +43,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html";
meta.screenshots = new String[0];
meta.logoFile = "/forge_logo.png";
Configuration config = new Configuration(new File(Loader.instance().getConfigDir(), "forge.cfg"));
if (!config.isChild)
{
@ -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

@ -9,51 +9,50 @@ 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 {
/**
* No block. Completeness really.
*/
NONE,
/**
* Vanilla style block, up to 8 flowing states. May be able to generate new sources.
*/
VANILLA,
/**
* Finite liquid style, uses cellular automata to model flowing behaviour.
*/
FINITE;
}
/**
* Controls the type of block that is generated by this IBlockLiquid
*
*/
public enum BlockType {
/**
* No block. Completeness really.
*/
NONE,
/**
* Vanilla style block, up to 8 flowing states. May be able to generate new sources.
*/
VANILLA,
/**
* Finite liquid style, uses cellular automata to model flowing behaviour.
*/
FINITE;
}
/**
* Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid.
* @return
*/
public boolean willGenerateSources();
/**
* Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid.
* @return if this liquid will generate new sources
*/
public boolean willGenerateSources();
/**
* @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types.
*/
public int getFlowDistance();
/**
* @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types.
*/
public int getFlowDistance();
/**
* @return the RGB rendering for this liquid
*/
public byte[] getLiquidRGB();
/**
* @return the RGB rendering for this liquid
*/
public byte[] getLiquidRGB();
/**
* Get the texture file for rendering the liquid
* @return
*/
public String getLiquidBlockTextureFile();
/**
* Custom properties of the liquid.
* @return
*/
public NBTTagCompound getLiquidProperties();
/**
* Get the texture file for rendering the liquid
* @return the texture file for this liquid
*/
public String getLiquidBlockTextureFile();
/**
* Custom properties of the liquid.
* @return a compound tag of custom liquid properties
*/
public NBTTagCompound getLiquidProperties();
}

View File

@ -15,21 +15,21 @@ package net.minecraftforge.liquids;
*/
public interface ILiquid {
/**
* The itemId of the liquid item
* @return
*/
public int stillLiquidId();
/**
* The itemId of the liquid item
* @return the itemId
*/
public int stillLiquidId();
/**
* Is this liquid a metadata based liquid
* @return
*/
public boolean isMetaSensitive();
/**
* Is this liquid a metadata based liquid
* @return if this is a metadata liquid
*/
public boolean isMetaSensitive();
/**
* The item metadata of the liquid
* @return
*/
public int stillLiquidMeta();
/**
* The item metadata of the liquid
* @return the metadata of the liquid
*/
public int stillLiquidMeta();
}

View File

@ -7,38 +7,38 @@ package net.minecraftforge.liquids;
*/
public interface ILiquidTank {
/**
* @return LiquidStack representing the liquid contained in the tank, null if empty.
*/
LiquidStack getLiquid();
/**
* @return LiquidStack representing the liquid contained in the tank, null if empty.
*/
LiquidStack getLiquid();
/**
* @return capacity of this tank
*/
int getCapacity();
/**
* @return capacity of this tank
*/
int getCapacity();
/**
*
* @param resource
* @param doFill
* @return Amount of liquid used for filling.
*/
int fill(LiquidStack resource, boolean doFill);
/**
*
* @param maxDrain
* @param doDrain
* @return Null if nothing was drained, otherwise a LiquidStack containing the drained.
*/
LiquidStack drain(int maxDrain, boolean doDrain);
/**
*
* @param resource
* @param doFill
* @return Amount of liquid used for filling.
*/
int fill(LiquidStack resource, boolean doFill);
/**
*
* @param maxDrain
* @param doDrain
* @return Null if nothing was drained, otherwise a LiquidStack containing the drained.
*/
LiquidStack drain(int maxDrain, boolean doDrain);
/**
* Positive values indicate a positive liquid pressure (liquid wants to leave this tank)
* Negative values indicate a negative liquid pressure (liquid wants to fill this tank)
* Zero indicates no pressure
*
* @return a number indicating tank pressure
*/
public int getTankPressure();
/**
* Positive values indicate a positive liquid pressure (liquid wants to leave this tank)
* Negative values indicate a negative liquid pressure (liquid wants to fill this tank)
* Zero indicates no pressure
*
* @return a number indicating tank pressure
*/
public int getTankPressure();
}

View File

@ -4,53 +4,53 @@ import net.minecraftforge.common.ForgeDirection;
public interface ITankContainer {
/**
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is pumped in from.
* @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.
*/
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 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.
*/
int fill(int tankIndex, LiquidStack resource, boolean doFill);
/**
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is pumped in from.
* @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.
*/
int fill(ForgeDirection from, LiquidStack resource, boolean doFill);
/**
* Fills liquid into the specified internal tank.
* @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.
*/
int fill(int tankIndex, LiquidStack resource, boolean doFill);
/**
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is drained to.
* @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
*/
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 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
*/
LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain);
/**
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is drained to.
* @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
*/
LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
/**
* Drains liquid out of the specified internal tank.
* @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
*/
LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain);
/**
* @param direction tank side: UNKNOWN for default tank set
* @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction
*/
ILiquidTank[] getTanks(ForgeDirection direction);
/**
* @param direction tank side: UNKNOWN for default tank set
* @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction
*/
ILiquidTank[] getTanks(ForgeDirection direction);
/**
* Return the tank that this tank container desired to be used for the specified liquid type from the specified direction
*
* @param direction the direction
* @param type the liquid type, null is always an acceptable value
* @return a tank or null for no such tank
*/
ILiquidTank getTank(ForgeDirection direction, LiquidStack type);
/**
* Return the tank that this tank container desired to be used for the specified liquid type from the specified direction
*
* @param direction the direction
* @param type the liquid type, null is always an acceptable value
* @return a tank or null for no such tank
*/
ILiquidTank getTank(ForgeDirection direction, LiquidStack type);
}

View File

@ -14,18 +14,18 @@ import net.minecraft.item.ItemStack;
public class LiquidContainerData {
public final LiquidStack stillLiquid;
public final ItemStack filled;
public final ItemStack container;
public final LiquidStack stillLiquid;
public final ItemStack filled;
public final ItemStack container;
public LiquidContainerData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) {
this.stillLiquid = stillLiquid;
this.filled = filled;
this.container = container;
public LiquidContainerData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) {
this.stillLiquid = stillLiquid;
this.filled = filled;
this.container = container;
if(stillLiquid == null || filled == null || container == null)
throw new RuntimeException("stillLiquid, filled, or container is null, this is an error");
}
if(stillLiquid == null || filled == null || container == null)
throw new RuntimeException("stillLiquid, filled, or container is null, this is an error");
}
}

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

@ -28,7 +28,7 @@ public class LiquidStack
this.itemMeta = itemDamage;
}
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt.setShort("Id", (short)itemID);
nbt.setInteger("Amount", amount);
@ -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;
+ }
}