Merge branch '1.9.4'

This commit is contained in:
cpw committed 2016-05-31 00:34:03 -04:00
commit caa61e1be9
332 files changed
+3806 -3131

No files matched your search

@@ -115,7 +115,7 @@ public class BiomeDictionary
private static HashMap<ResourceLocation, BiomeInfo> biomeInfoMap = new HashMap<ResourceLocation, BiomeInfo>();
@SuppressWarnings("unchecked")
private static ArrayList<BiomeGenBase>[] typeInfoList = new ArrayList[Type.values().length];
private static ArrayList<Biome>[] typeInfoList = new ArrayList[Type.values().length];
private static class BiomeInfo
{
@@ -143,17 +143,17 @@ public class BiomeDictionary
* @param types the types to register the biome as
* @return returns true if the biome was registered successfully
*/
public static boolean registerBiomeType(BiomeGenBase biome, Type ... types)
public static boolean registerBiomeType(Biome biome, Type ... types)
{
types = listSubTags(types);
if(BiomeGenBase.biomeRegistry.getNameForObject(biome) != null)
if(Biome.REGISTRY.getNameForObject(biome) != null)
{
for(Type type : types)
{
if(typeInfoList[type.ordinal()] == null)
{
typeInfoList[type.ordinal()] = new ArrayList<BiomeGenBase>();
typeInfoList[type.ordinal()] = new ArrayList<Biome>();
}
typeInfoList[type.ordinal()].add(biome);
@@ -161,7 +161,7 @@ public class BiomeDictionary
if(!isBiomeRegistered(biome))
{
ResourceLocation location = BiomeGenBase.biomeRegistry.getNameForObject(biome);
ResourceLocation location = Biome.REGISTRY.getNameForObject(biome);
biomeInfoMap.put(location, new BiomeInfo(types));
}
else
@@ -184,14 +184,14 @@ public class BiomeDictionary
* @param type the Type to look for
* @return a list of biomes of the specified type, null if there are none
*/
public static BiomeGenBase[] getBiomesForType(Type type)
public static Biome[] getBiomesForType(Type type)
{
if(typeInfoList[type.ordinal()] != null)
{
return typeInfoList[type.ordinal()].toArray(new BiomeGenBase[0]);
return typeInfoList[type.ordinal()].toArray(new Biome[0]);
}
return new BiomeGenBase[0];
return new Biome[0];
}
/**
@@ -200,10 +200,10 @@ public class BiomeDictionary
* @param biome the biome to check
* @return the list of types, null if there are none
*/
public static Type[] getTypesForBiome(BiomeGenBase biome)
public static Type[] getTypesForBiome(Biome biome)
{
checkRegistration(biome);
return getBiomeInfo(biome).typeList.toArray(new Type[0]);
checkRegistration(biome);
return getBiomeInfo(biome).typeList.toArray(new Type[0]);
}
/**
@@ -213,17 +213,17 @@ public class BiomeDictionary
* @param biomeB
* @return returns true if a common type is found, false otherwise
*/
public static boolean areBiomesEquivalent(BiomeGenBase biomeA, BiomeGenBase biomeB)
public static boolean areBiomesEquivalent(Biome biomeA, Biome biomeB)
{
checkRegistration(biomeA);
checkRegistration(biomeB);
for(Type type : getTypesForBiome(biomeA))
{
if(containsType(getBiomeInfo(biomeB), type))
{
return true;
}
if(containsType(getBiomeInfo(biomeB), type))
{
return true;
}
}
return false;
@@ -236,7 +236,7 @@ public class BiomeDictionary
* @param type the type to check for
* @return returns true if the biome is registered as being of type type, false otherwise
*/
public static boolean isBiomeOfType(BiomeGenBase biome, Type type)
public static boolean isBiomeOfType(Biome biome, Type type)
{
checkRegistration(biome);
return containsType(getBiomeInfo(biome), type);
@@ -247,9 +247,9 @@ public class BiomeDictionary
* @param biome the biome to consider
* @return returns true if the biome has been registered, false otherwise
*/
public static boolean isBiomeRegistered(BiomeGenBase biome)
public static boolean isBiomeRegistered(Biome biome)
{
return biomeInfoMap.containsKey(BiomeGenBase.biomeRegistry.getNameForObject(biome));
return biomeInfoMap.containsKey(Biome.REGISTRY.getNameForObject(biome));
}
public static void registerAllBiomes()
@@ -265,10 +265,10 @@ public class BiomeDictionary
*/
public static void registerAllBiomesAndGenerateEvents()
{
for (ResourceLocation biomeResource : BiomeGenBase.biomeRegistry.getKeys())
{
BiomeGenBase biome = BiomeGenBase.biomeRegistry.getObject(biomeResource);
for (ResourceLocation biomeResource : Biome.REGISTRY.getKeys())
{
Biome biome = Biome.REGISTRY.getObject(biomeResource);
if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator)
{
DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator;
@@ -286,7 +286,7 @@ public class BiomeDictionary
*
* @param biome the biome to be considered
*/
public static void makeBestGuess(BiomeGenBase biome)
public static void makeBestGuess(Biome biome)
{
if (biome.theBiomeDecorator.treesPerChunk >= 3)
{
@@ -373,32 +373,32 @@ public class BiomeDictionary
BiomeDictionary.registerBiomeType(biome, SNOWY);
}
if (biome.topBlock != Blocks.sand && biome.getTemperature() >= 1.0f && biome.getRainfall() < 0.2f)
if (biome.topBlock != Blocks.SAND && biome.getTemperature() >= 1.0f && biome.getRainfall() < 0.2f)
{
BiomeDictionary.registerBiomeType(biome, SAVANNA);
}
if (biome.topBlock == Blocks.sand )
if (biome.topBlock == Blocks.SAND)
{
BiomeDictionary.registerBiomeType(biome, SANDY);
}
else if (biome.topBlock == Blocks.mycelium)
else if (biome.topBlock == Blocks.MYCELIUM)
{
BiomeDictionary.registerBiomeType(biome, MUSHROOM);
}
if (biome.fillerBlock == Blocks.hardened_clay)
if (biome.fillerBlock == Blocks.HARDENED_CLAY)
{
BiomeDictionary.registerBiomeType(biome, MESA);
}
}
//Internal implementation
private static BiomeInfo getBiomeInfo(BiomeGenBase biome)
private static BiomeInfo getBiomeInfo(Biome biome)
{
return biomeInfoMap.get(BiomeGenBase.biomeRegistry.getNameForObject(biome));
return biomeInfoMap.get(Biome.REGISTRY.getNameForObject(biome));
}
private static void checkRegistration(BiomeGenBase biome)
private static void checkRegistration(Biome biome)
{
if(!isBiomeRegistered(biome))
{
@@ -436,45 +436,45 @@ public class BiomeDictionary
private static void registerVanillaBiomes()
{
registerBiomeType(Biomes.ocean, OCEAN );
registerBiomeType(Biomes.plains, PLAINS );
registerBiomeType(Biomes.desert, HOT, DRY, SANDY );
registerBiomeType(Biomes.extremeHills, MOUNTAIN, HILLS );
registerBiomeType(Biomes.forest, FOREST );
registerBiomeType(Biomes.taiga, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.taigaHills, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.swampland, WET, SWAMP );
registerBiomeType(Biomes.river, RIVER );
registerBiomeType(Biomes.frozenOcean, COLD, OCEAN, SNOWY );
registerBiomeType(Biomes.frozenRiver, COLD, RIVER, SNOWY );
registerBiomeType(Biomes.icePlains, COLD, SNOWY, WASTELAND );
registerBiomeType(Biomes.iceMountains, COLD, SNOWY, MOUNTAIN );
registerBiomeType(Biomes.beach, BEACH );
registerBiomeType(Biomes.desertHills, HOT, DRY, SANDY, HILLS );
registerBiomeType(Biomes.jungle, HOT, WET, DENSE, JUNGLE );
registerBiomeType(Biomes.jungleHills, HOT, WET, DENSE, JUNGLE, HILLS);
registerBiomeType(Biomes.forestHills, FOREST, HILLS );
registerBiomeType(Biomes.sky, COLD, DRY, END );
registerBiomeType(Biomes.hell, HOT, DRY, NETHER );
registerBiomeType(Biomes.mushroomIsland, MUSHROOM );
registerBiomeType(Biomes.extremeHillsEdge, MOUNTAIN );
registerBiomeType(Biomes.mushroomIslandShore, MUSHROOM, BEACH );
registerBiomeType(Biomes.jungleEdge, HOT, WET, JUNGLE, FOREST );
registerBiomeType(Biomes.deepOcean, OCEAN );
registerBiomeType(Biomes.stoneBeach, BEACH );
registerBiomeType(Biomes.coldBeach, COLD, BEACH, SNOWY );
registerBiomeType(Biomes.birchForest, FOREST );
registerBiomeType(Biomes.birchForestHills, FOREST, HILLS );
registerBiomeType(Biomes.roofedForest, SPOOKY, DENSE, FOREST );
registerBiomeType(Biomes.coldTaiga, COLD, CONIFEROUS, FOREST, SNOWY );
registerBiomeType(Biomes.coldTaigaHills, COLD, CONIFEROUS, FOREST, SNOWY, HILLS);
registerBiomeType(Biomes.megaTaiga, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.megaTaigaHills, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.extremeHillsPlus, MOUNTAIN, FOREST, SPARSE );
registerBiomeType(Biomes.savanna, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.savannaPlateau, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.mesa, MESA, SANDY );
registerBiomeType(Biomes.mesaPlateau_F, MESA, SPARSE, SANDY );
registerBiomeType(Biomes.mesaPlateau, MESA, SANDY );
registerBiomeType(Biomes.OCEAN, OCEAN );
registerBiomeType(Biomes.PLAINS, PLAINS );
registerBiomeType(Biomes.DESERT, HOT, DRY, SANDY );
registerBiomeType(Biomes.EXTREME_HILLS, MOUNTAIN, HILLS );
registerBiomeType(Biomes.FOREST, FOREST );
registerBiomeType(Biomes.TAIGA, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.SWAMPLAND, WET, SWAMP );
registerBiomeType(Biomes.RIVER, RIVER );
registerBiomeType(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY );
registerBiomeType(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY );
registerBiomeType(Biomes.ICE_PLAINS, COLD, SNOWY, WASTELAND );
registerBiomeType(Biomes.ICE_MOUNTAINS, COLD, SNOWY, MOUNTAIN );
registerBiomeType(Biomes.BEACH, BEACH );
registerBiomeType(Biomes.DESERT_HILLS, HOT, DRY, SANDY, HILLS );
registerBiomeType(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE );
registerBiomeType(Biomes.JUNGLE_HILLS, HOT, WET, DENSE, JUNGLE, HILLS);
registerBiomeType(Biomes.FOREST_HILLS, FOREST, HILLS );
registerBiomeType(Biomes.SKY, COLD, DRY, END );
registerBiomeType(Biomes.HELL, HOT, DRY, NETHER );
registerBiomeType(Biomes.MUSHROOM_ISLAND, MUSHROOM );
registerBiomeType(Biomes.EXTREME_HILLS_EDGE, MOUNTAIN );
registerBiomeType(Biomes.MUSHROOM_ISLAND_SHORE, MUSHROOM, BEACH );
registerBiomeType(Biomes.JUNGLE_EDGE, HOT, WET, JUNGLE, FOREST );
registerBiomeType(Biomes.DEEP_OCEAN, OCEAN );
registerBiomeType(Biomes.STONE_BEACH, BEACH );
registerBiomeType(Biomes.COLD_BEACH, COLD, BEACH, SNOWY );
registerBiomeType(Biomes.BIRCH_FOREST, FOREST );
registerBiomeType(Biomes.BIRCH_FOREST_HILLS, FOREST, HILLS );
registerBiomeType(Biomes.ROOFED_FOREST, SPOOKY, DENSE, FOREST );
registerBiomeType(Biomes.COLD_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY );
registerBiomeType(Biomes.COLD_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, SNOWY, HILLS);
registerBiomeType(Biomes.REDWOOD_TAIGA, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.REDWOOD_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.EXTREME_HILLS_WITH_TREES, MOUNTAIN, FOREST, SPARSE );
registerBiomeType(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.MESA, MESA, SANDY );
registerBiomeType(Biomes.MESA_ROCK, MESA, SPARSE, SANDY );
registerBiomeType(Biomes.MESA_CLEAR_ROCK, MESA, SANDY );
}
}
@@ -9,7 +9,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.init.Biomes;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraft.world.gen.structure.MapGenVillage;
import net.minecraftforge.common.util.EnumHelper;
@@ -18,16 +18,16 @@ public class BiomeManager
{
private static TrackedList<BiomeEntry>[] biomes = setupBiomes();
public static List<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
public static List<Biome> oceanBiomes = new ArrayList<Biome>();
public static ArrayList<BiomeGenBase> strongHoldBiomes = new ArrayList<BiomeGenBase>();
public static ArrayList<BiomeGenBase> strongHoldBiomesBlackList = new ArrayList<BiomeGenBase>();
public static ArrayList<Biome> strongHoldBiomes = new ArrayList<Biome>();
public static ArrayList<Biome> strongHoldBiomesBlackList = new ArrayList<Biome>();
static
{
oceanBiomes.add(Biomes.ocean);
oceanBiomes.add(Biomes.deepOcean);
oceanBiomes.add(Biomes.frozenOcean);
oceanBiomes.add(Biomes.OCEAN);
oceanBiomes.add(Biomes.DEEP_OCEAN);
oceanBiomes.add(Biomes.FROZEN_OCEAN);
}
private static TrackedList<BiomeEntry>[] setupBiomes()
@@ -36,26 +36,26 @@ public class BiomeManager
TrackedList<BiomeEntry>[] currentBiomes = new TrackedList[BiomeType.values().length];
List<BiomeEntry> list = new ArrayList<BiomeEntry>();
list.add(new BiomeEntry(Biomes.forest, 10));
list.add(new BiomeEntry(Biomes.roofedForest, 10));
list.add(new BiomeEntry(Biomes.extremeHills, 10));
list.add(new BiomeEntry(Biomes.plains, 10));
list.add(new BiomeEntry(Biomes.birchForest, 10));
list.add(new BiomeEntry(Biomes.swampland, 10));
list.add(new BiomeEntry(Biomes.FOREST, 10));
list.add(new BiomeEntry(Biomes.ROOFED_FOREST, 10));
list.add(new BiomeEntry(Biomes.EXTREME_HILLS, 10));
list.add(new BiomeEntry(Biomes.PLAINS, 10));
list.add(new BiomeEntry(Biomes.BIRCH_FOREST, 10));
list.add(new BiomeEntry(Biomes.SWAMPLAND, 10));
currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList<BiomeEntry>(list);
list.clear();
list.add(new BiomeEntry(Biomes.forest, 10));
list.add(new BiomeEntry(Biomes.extremeHills, 10));
list.add(new BiomeEntry(Biomes.taiga, 10));
list.add(new BiomeEntry(Biomes.plains, 10));
list.add(new BiomeEntry(Biomes.FOREST, 10));
list.add(new BiomeEntry(Biomes.EXTREME_HILLS, 10));
list.add(new BiomeEntry(Biomes.TAIGA, 10));
list.add(new BiomeEntry(Biomes.PLAINS, 10));
currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList<BiomeEntry>(list);
list.clear();
list.add(new BiomeEntry(Biomes.icePlains, 30));
list.add(new BiomeEntry(Biomes.coldTaiga, 10));
list.add(new BiomeEntry(Biomes.ICE_PLAINS, 30));
list.add(new BiomeEntry(Biomes.COLD_TAIGA, 10));
currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList<BiomeEntry>(list);
list.clear();
@@ -65,27 +65,27 @@ public class BiomeManager
return currentBiomes;
}
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
public static void addVillageBiome(Biome biome, boolean canSpawn)
{
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
if (!MapGenVillage.VILLAGE_SPAWN_BIOMES.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.VILLAGE_SPAWN_BIOMES);
biomes.add(biome);
MapGenVillage.villageSpawnBiomes = biomes;
MapGenVillage.VILLAGE_SPAWN_BIOMES = biomes;
}
}
public static void removeVillageBiome(BiomeGenBase biome)
public static void removeVillageBiome(Biome biome)
{
if (MapGenVillage.villageSpawnBiomes.contains(biome))
if (MapGenVillage.VILLAGE_SPAWN_BIOMES.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.VILLAGE_SPAWN_BIOMES);
biomes.remove(biome);
MapGenVillage.villageSpawnBiomes = biomes;
MapGenVillage.VILLAGE_SPAWN_BIOMES = biomes;
}
}
public static void addStrongholdBiome(BiomeGenBase biome)
public static void addStrongholdBiome(Biome biome)
{
if (!strongHoldBiomes.contains(biome))
{
@@ -93,7 +93,7 @@ public class BiomeManager
}
}
public static void removeStrongholdBiome(BiomeGenBase biome)
public static void removeStrongholdBiome(Biome biome)
{
if (!strongHoldBiomesBlackList.contains(biome))
{
@@ -101,7 +101,7 @@ public class BiomeManager
}
}
public static void addSpawnBiome(BiomeGenBase biome)
public static void addSpawnBiome(Biome biome)
{
if (!BiomeProvider.allowedBiomes.contains(biome))
{
@@ -109,7 +109,7 @@ public class BiomeManager
}
}
public static void removeSpawnBiome(BiomeGenBase biome)
public static void removeSpawnBiome(Biome biome)
{
if (BiomeProvider.allowedBiomes.contains(biome))
{
@@ -179,9 +179,9 @@ public class BiomeManager
public static class BiomeEntry extends WeightedRandom.Item
{
public final BiomeGenBase biome;
public final Biome biome;
public BiomeEntry(BiomeGenBase biome, int weight)
public BiomeEntry(Biome biome, int weight)
{
super(weight);
@@ -23,7 +23,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.world.DimensionType;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.World;
import net.minecraft.world.WorldManager;
import net.minecraft.world.ServerWorldEventHandler;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldServerMulti;
@@ -209,7 +209,7 @@ public class DimensionManager
//WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());
WorldServer world = (dim == 0 ? overworld : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init()));
world.addEventListener(new WorldManager(mcServer, world));
world.addEventListener(new ServerWorldEventHandler(mcServer, world));
MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
if (!mcServer.isSinglePlayer())
{
@@ -22,8 +22,8 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
@@ -90,7 +90,7 @@ public class ForgeChunkManager
private static Map<String, LoadingCallback> callbacks = Maps.newHashMap();
private static Map<World, ImmutableSetMultimap<ChunkCoordIntPair,Ticket>> forcedChunks = new MapMaker().weakKeys().makeMap();
private static Map<World, ImmutableSetMultimap<ChunkPos,Ticket>> forcedChunks = new MapMaker().weakKeys().makeMap();
private static BiMap<UUID,Ticket> pendingEntities = HashBiMap.create();
private static Map<World,Cache<Long, Chunk>> dormantChunkCache = new MapMaker().weakKeys().makeMap();
@@ -112,13 +112,13 @@ public class ForgeChunkManager
public static Iterator<Chunk> getPersistentChunksIterableFor(final World world, Iterator<Chunk> chunkIterator)
{
final ImmutableSetMultimap<ChunkCoordIntPair, Ticket> persistentChunksFor = getPersistentChunksFor(world);
final ImmutableSetMultimap<ChunkPos, Ticket> persistentChunksFor = getPersistentChunksFor(world);
final ImmutableSet.Builder<Chunk> builder = ImmutableSet.builder();
world.theProfiler.startSection("forcedChunkLoading");
builder.addAll(Iterators.transform(persistentChunksFor.keys().iterator(), new Function<ChunkCoordIntPair, Chunk>() {
builder.addAll(Iterators.transform(persistentChunksFor.keys().iterator(), new Function<ChunkPos, Chunk>() {
@Nullable
@Override
public Chunk apply(@Nullable ChunkCoordIntPair input)
public Chunk apply(@Nullable ChunkPos input)
{
return world.getChunkFromChunkCoords(input.chunkXPos, input.chunkZPos);
}
@@ -216,7 +216,7 @@ public class ForgeChunkManager
{
private String modId;
private Type ticketType;
private LinkedHashSet<ChunkCoordIntPair> requestedChunks;
private LinkedHashSet<ChunkPos> requestedChunks;
private NBTTagCompound modData;
public final World world;
private int maxDepth;
@@ -363,7 +363,7 @@ public class ForgeChunkManager
/**
* Gets a list of requested chunks for this ticket.
*/
public ImmutableSet<ChunkCoordIntPair> getChunkList()
public ImmutableSet<ChunkPos> getChunkList()
{
return ImmutableSet.copyOf(requestedChunks);
}
@@ -371,9 +371,9 @@ public class ForgeChunkManager
public static class ForceChunkEvent extends Event {
private final Ticket ticket;
private final ChunkCoordIntPair location;
private final ChunkPos location;
public ForceChunkEvent(Ticket ticket, ChunkCoordIntPair location)
public ForceChunkEvent(Ticket ticket, ChunkPos location)
{
this.ticket = ticket;
this.location = location;
@@ -384,7 +384,7 @@ public class ForgeChunkManager
return ticket;
}
public ChunkCoordIntPair getLocation()
public ChunkPos getLocation()
{
return location;
}
@@ -392,9 +392,9 @@ public class ForgeChunkManager
public static class UnforceChunkEvent extends Event {
private final Ticket ticket;
private final ChunkCoordIntPair location;
private final ChunkPos location;
public UnforceChunkEvent(Ticket ticket, ChunkCoordIntPair location)
public UnforceChunkEvent(Ticket ticket, ChunkPos location)
{
this.ticket = ticket;
this.location = location;
@@ -405,7 +405,7 @@ public class ForgeChunkManager
return ticket;
}
public ChunkCoordIntPair getLocation()
public ChunkPos getLocation()
{
return location;
}
@@ -444,7 +444,7 @@ public class ForgeChunkManager
ArrayListMultimap<String, Ticket> newTickets = ArrayListMultimap.create();
tickets.put(world, newTickets);
forcedChunks.put(world, ImmutableSetMultimap.<ChunkCoordIntPair,Ticket>of());
forcedChunks.put(world, ImmutableSetMultimap.<ChunkPos,Ticket>of());
if (!(world instanceof WorldServer))
{
@@ -743,7 +743,7 @@ public class ForgeChunkManager
}
if (ticket.requestedChunks!=null)
{
for (ChunkCoordIntPair chunk : ImmutableSet.copyOf(ticket.requestedChunks))
for (ChunkPos chunk : ImmutableSet.copyOf(ticket.requestedChunks))
{
unforceChunk(ticket, chunk);
}
@@ -767,7 +767,7 @@ public class ForgeChunkManager
* @param ticket The ticket registering the chunk
* @param chunk The chunk to force
*/
public static void forceChunk(Ticket ticket, ChunkCoordIntPair chunk)
public static void forceChunk(Ticket ticket, ChunkPos chunk)
{
if (ticket == null || chunk == null)
{
@@ -785,11 +785,11 @@ public class ForgeChunkManager
ticket.requestedChunks.add(chunk);
MinecraftForge.EVENT_BUS.post(new ForceChunkEvent(ticket, chunk));
ImmutableSetMultimap<ChunkCoordIntPair, Ticket> newMap = ImmutableSetMultimap.<ChunkCoordIntPair,Ticket>builder().putAll(forcedChunks.get(ticket.world)).put(chunk, ticket).build();
ImmutableSetMultimap<ChunkPos, Ticket> newMap = ImmutableSetMultimap.<ChunkPos,Ticket>builder().putAll(forcedChunks.get(ticket.world)).put(chunk, ticket).build();
forcedChunks.put(ticket.world, newMap);
if (ticket.maxDepth > 0 && ticket.requestedChunks.size() > ticket.maxDepth)
{
ChunkCoordIntPair removed = ticket.requestedChunks.iterator().next();
ChunkPos removed = ticket.requestedChunks.iterator().next();
unforceChunk(ticket,removed);
}
}
@@ -802,7 +802,7 @@ public class ForgeChunkManager
* @param ticket The ticket holding the chunk list
* @param chunk The chunk you wish to push to the end (so that it would be unloaded last)
*/
public static void reorderChunk(Ticket ticket, ChunkCoordIntPair chunk)
public static void reorderChunk(Ticket ticket, ChunkPos chunk)
{
if (ticket == null || chunk == null || !ticket.requestedChunks.contains(chunk))
{
@@ -817,7 +817,7 @@ public class ForgeChunkManager
* @param ticket The ticket holding the chunk
* @param chunk The chunk to unforce
*/
public static void unforceChunk(Ticket ticket, ChunkCoordIntPair chunk)
public static void unforceChunk(Ticket ticket, ChunkPos chunk)
{
if (ticket == null || chunk == null)
{
@@ -825,9 +825,9 @@ public class ForgeChunkManager
}
ticket.requestedChunks.remove(chunk);
MinecraftForge.EVENT_BUS.post(new UnforceChunkEvent(ticket, chunk));
LinkedHashMultimap<ChunkCoordIntPair, Ticket> copy = LinkedHashMultimap.create(forcedChunks.get(ticket.world));
LinkedHashMultimap<ChunkPos, Ticket> copy = LinkedHashMultimap.create(forcedChunks.get(ticket.world));
copy.remove(chunk, ticket);
ImmutableSetMultimap<ChunkCoordIntPair, Ticket> newMap = ImmutableSetMultimap.copyOf(copy);
ImmutableSetMultimap<ChunkPos, Ticket> newMap = ImmutableSetMultimap.copyOf(copy);
forcedChunks.put(ticket.world,newMap);
}
@@ -857,9 +857,9 @@ public class ForgeChunkManager
* @param world
* @return the list of persistent chunks in the world
*/
public static ImmutableSetMultimap<ChunkCoordIntPair, Ticket> getPersistentChunksFor(World world)
public static ImmutableSetMultimap<ChunkPos, Ticket> getPersistentChunksFor(World world)
{
return forcedChunks.containsKey(world) ? forcedChunks.get(world) : ImmutableSetMultimap.<ChunkCoordIntPair,Ticket>of();
return forcedChunks.containsKey(world) ? forcedChunks.get(world) : ImmutableSetMultimap.<ChunkPos,Ticket>of();
}
static void saveWorld(World world)
@@ -176,11 +176,11 @@ public class ForgeHooks
if (!canHarvestBlock(state.getBlock(), player, world, pos))
{
return player.getBreakSpeed(state, pos) / hardness / 100F;
return player.getDigSpeed(state, pos) / hardness / 100F;
}
else
{
return player.getBreakSpeed(state, pos) / hardness / 30F;
return player.getDigSpeed(state, pos) / hardness / 30F;
}
}
@@ -222,20 +222,21 @@ public class ForgeHooks
block.setHarvestLevel("axe", 0);
}
Blocks.obsidian.setHarvestLevel("pickaxe", 3);
Blocks.OBSIDIAN.setHarvestLevel("pickaxe", 3);
Blocks.ENCHANTING_TABLE.setHarvestLevel("pickaxe", 0);
Block[] oreBlocks = new Block[] {
Blocks.emerald_ore, Blocks.emerald_block, Blocks.diamond_ore, Blocks.diamond_block,
Blocks.gold_ore, Blocks.gold_block, Blocks.redstone_ore, Blocks.lit_redstone_ore
Blocks.EMERALD_ORE, Blocks.EMERALD_BLOCK, Blocks.DIAMOND_ORE, Blocks.DIAMOND_BLOCK,
Blocks.GOLD_ORE, Blocks.GOLD_BLOCK, Blocks.REDSTONE_ORE, Blocks.LIT_REDSTONE_ORE
};
for (Block block : oreBlocks)
{
block.setHarvestLevel("pickaxe", 2);
}
Blocks.iron_ore.setHarvestLevel("pickaxe", 1);
Blocks.iron_block.setHarvestLevel("pickaxe", 1);
Blocks.lapis_ore.setHarvestLevel("pickaxe", 1);
Blocks.lapis_block.setHarvestLevel("pickaxe", 1);
Blocks.quartz_ore.setHarvestLevel("pickaxe", 0);
Blocks.IRON_ORE.setHarvestLevel("pickaxe", 1);
Blocks.IRON_BLOCK.setHarvestLevel("pickaxe", 1);
Blocks.LAPIS_ORE.setHarvestLevel("pickaxe", 1);
Blocks.LAPIS_BLOCK.setHarvestLevel("pickaxe", 1);
Blocks.QUARTZ_ORE.setHarvestLevel("pickaxe", 0);
}
public static int getTotalArmorValue(EntityPlayer player)
@@ -258,11 +259,11 @@ public class ForgeHooks
static
{
seedList.add(new SeedEntry(new ItemStack(Items.wheat_seeds), 10)
seedList.add(new SeedEntry(new ItemStack(Items.WHEAT_SEEDS), 10)
{
public ItemStack getStack(Random rand, int fortune)
{
return new ItemStack(Items.wheat_seeds, 1 + rand.nextInt(fortune * 2 + 1));
return new ItemStack(Items.WHEAT_SEEDS, 1 + rand.nextInt(fortune * 2 + 1));
}
});
initTools();
@@ -422,7 +423,7 @@ public class ForgeHooks
if (target.typeOfHit == RayTraceResult.Type.BLOCK)
{
s1 = Block.blockRegistry.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock()).toString();
s1 = Block.REGISTRY.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock()).toString();
}
else if (target.typeOfHit == RayTraceResult.Type.ENTITY)
{
@@ -440,7 +441,7 @@ public class ForgeHooks
if (isCreative)
{
player.inventory.func_184434_a(result);
player.inventory.setPickedItemStack(result);
Minecraft.getMinecraft().playerController.sendSlotPacket(player.getHeldItem(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem);
return true;
}
@@ -636,9 +637,9 @@ public class ForgeHooks
// Set the click event and append the link.
ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
link.getChatStyle().setChatClickEvent(click);
link.getChatStyle().setUnderlined(true);
link.getChatStyle().setColor(TextFormatting.BLUE);
link.getStyle().setClickEvent(click);
link.getStyle().setUnderlined(true);
link.getStyle().setColor(TextFormatting.BLUE);
if (ichat == null)
ichat = link;
else
@@ -685,8 +686,8 @@ public class ForgeHooks
if (world.getTileEntity(pos) == null)
{
SPacketBlockChange packet = new SPacketBlockChange(world, pos);
packet.blockState = Blocks.air.getDefaultState();
entityPlayer.playerNetServerHandler.sendPacket(packet);
packet.blockState = Blocks.AIR.getDefaultState();
entityPlayer.connection.sendPacket(packet);
}
// Post the block break event
@@ -699,16 +700,16 @@ public class ForgeHooks
if (event.isCanceled())
{
// Let the client know the block still exists
entityPlayer.playerNetServerHandler.sendPacket(new SPacketBlockChange(world, pos));
entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos));
// Update any tile entity data for this block
TileEntity tileentity = world.getTileEntity(pos);
if (tileentity != null)
{
Packet<?> pkt = tileentity.getDescriptionPacket();
Packet<?> pkt = tileentity.getUpdatePacket();
if (pkt != null)
{
entityPlayer.playerNetServerHandler.sendPacket(pkt);
entityPlayer.connection.sendPacket(pkt);
}
}
}
@@ -798,7 +799,7 @@ public class ForgeHooks
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag);
}
player.addStat(StatList.func_188060_a(itemstack.getItem()));
player.addStat(StatList.getCraftStats(itemstack.getItem()));
}
}
world.capturedBlockSnapshots.clear();
@@ -14,12 +14,20 @@ import java.net.URL;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.logging.log4j.Level;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatList;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.classloading.FMLForgePlugin;
@@ -36,6 +44,7 @@ import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.server.command.ForgeCommand;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
@@ -44,10 +53,13 @@ import net.minecraftforge.fml.client.FMLFolderResourcePack;
import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.fml.common.LoadController;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModMetadata;
import net.minecraftforge.fml.common.WorldAccessContainer;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
@@ -322,6 +334,36 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
List<String> all = Lists.newArrayList();
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashReportDetail.class.getName().replace('.', '/')))
all.add(asm.getClassName());
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashCallable.class.getName().replace('.', '/')))
all.add(asm.getClassName());
Iterator<String> itr = all.iterator();
while (itr.hasNext())
{
String cls = itr.next();
if (!cls.startsWith("net/minecraft/") &&
!cls.startsWith("net/minecraftforge/"))
itr.remove();
}
FMLLog.log("Forge", Level.DEBUG, "Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all)
{
FMLLog.log("Forge", Level.DEBUG, "\t" + name);
try
{
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());
}
catch (Exception e)
{
e.printStackTrace();
}
}
NetworkRegistry.INSTANCE.register(this, this.getClass(), "*", evt.getASMHarvestedData());
ForgeNetworkHandler.registerChannel(this, evt.getSide());
}
@@ -393,6 +435,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public void mappingChanged(FMLModIdMappingEvent evt)
{
OreDictionary.rebakeMap();
StatList.reinit();
}
@@ -462,4 +505,5 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
{
return updateJSONUrl;
}
}
@@ -33,15 +33,15 @@ public class ForgeVersion
//This number is incremented every time we remove deprecated code/major API changes, never reset
public static final int majorVersion = 12;
//This number is incremented every minecraft release, never reset
public static final int minorVersion = 16;
public static final int minorVersion = 17;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 1;
public static final int revisionVersion = 0;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0;
// This is the minecraft version we're building for - used in various places in Forge/FML code
public static final String mcVersion = "1.9";
public static final String mcVersion = "1.9.4";
// This is the MCP data version we're using
public static final String mcpVersion = "9.23";
public static final String mcpVersion = "9.28";
@SuppressWarnings("unused")
private static Status status = PENDING;
@SuppressWarnings("unused")
@@ -1,15 +1,22 @@
package net.minecraftforge.common;
import java.util.concurrent.Callable;
import com.google.common.collect.ObjectArrays;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.eventhandler.EventBus;
import net.minecraftforge.fml.relauncher.Side;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.Level;
import com.google.common.collect.Lists;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeHooks.SeedEntry;
import net.minecraftforge.fluids.FluidRegistry;
@@ -59,121 +66,45 @@ public class MinecraftForge
OreDictionary.getOreName(0);
//Force these classes to be defined, Should prevent derp error hiding.
@SuppressWarnings("unused")
CrashReport fake = new CrashReport("ThisIsFake", new Exception("Not real"));
//Lets init World's crash report inner classes to prevent them from hiding errors.
String[] handlers = {
"net.minecraft.world.World$1",
"net.minecraft.world.World$2",
"net.minecraft.world.World$3",
"net.minecraft.world.World$4",
"net.minecraft.world.chunk.Chunk$1",
"net.minecraft.world.chunk.Chunk$2",
"net.minecraft.world.chunk.Chunk$3",
"net.minecraft.command.server.CommandBlockLogic$1",
"net.minecraft.command.server.CommandBlockLogic$2",
"net.minecraft.crash.CrashReportCategory$1",
"net.minecraft.crash.CrashReportCategory$2",
"net.minecraft.crash.CrashReportCategory$3",
"net.minecraft.crash.CrashReportCategory$4",
"net.minecraft.crash.CrashReportCategory$5",
"net.minecraft.crash.CrashReportCategory$Entry",
"net.minecraft.entity.Entity$1",
"net.minecraft.entity.Entity$2",
"net.minecraft.entity.Entity$3",
"net.minecraft.entity.Entity$4",
"net.minecraft.entity.EntityTracker$1",
"net.minecraft.world.gen.layer.GenLayer$1",
"net.minecraft.world.gen.layer.GenLayer$2",
"net.minecraft.entity.player.InventoryPlayer$1",
"net.minecraft.world.gen.structure.MapGenStructure$1",
"net.minecraft.world.gen.structure.MapGenStructure$2",
"net.minecraft.world.gen.structure.MapGenStructure$3",
"net.minecraft.server.MinecraftServer$3",
"net.minecraft.server.MinecraftServer$4",
"net.minecraft.server.MinecraftServer$5",
"net.minecraft.nbt.NBTTagCompound$1",
"net.minecraft.nbt.NBTTagCompound$2",
"net.minecraft.network.NetHandlerPlayServer$2",
"net.minecraft.network.NetworkSystem$3",
"net.minecraft.tileentity.TileEntity$1",
"net.minecraft.tileentity.TileEntity$2",
"net.minecraft.tileentity.TileEntity$3",
"net.minecraft.world.storage.WorldInfo$1",
"net.minecraft.world.storage.WorldInfo$2",
"net.minecraft.world.storage.WorldInfo$3",
"net.minecraft.world.storage.WorldInfo$4",
"net.minecraft.world.storage.WorldInfo$5",
"net.minecraft.world.storage.WorldInfo$6",
"net.minecraft.world.storage.WorldInfo$7",
"net.minecraft.world.storage.WorldInfo$8",
"net.minecraft.world.storage.WorldInfo$9"
};
String[] client = {
"net.minecraft.client.Minecraft$3",
"net.minecraft.client.Minecraft$4",
"net.minecraft.client.Minecraft$5",
"net.minecraft.client.Minecraft$6",
"net.minecraft.client.Minecraft$7",
"net.minecraft.client.Minecraft$8",
"net.minecraft.client.Minecraft$9",
"net.minecraft.client.Minecraft$10",
"net.minecraft.client.Minecraft$11",
"net.minecraft.client.Minecraft$12",
"net.minecraft.client.Minecraft$13",
"net.minecraft.client.Minecraft$14",
"net.minecraft.client.Minecraft$15",
"net.minecraft.client.multiplayer.WorldClient$1",
"net.minecraft.client.multiplayer.WorldClient$2",
"net.minecraft.client.multiplayer.WorldClient$3",
"net.minecraft.client.multiplayer.WorldClient$4",
"net.minecraft.client.particle,EffectRenderer$1",
"net.minecraft.client.particle,EffectRenderer$2",
"net.minecraft.client.particle,EffectRenderer$3",
"net.minecraft.client.particle,EffectRenderer$4",
"net.minecraft.client.renderer.EntityRenderer$1",
"net.minecraft.client.renderer.EntityRenderer$2",
"net.minecraft.client.renderer.EntityRenderer$3",
"net.minecraft.server.integrated.IntegratedServer$1",
"net.minecraft.server.integrated.IntegratedServer$2",
"net.minecraft.client.renderer.RenderGlobal$1",
"net.minecraft.client.renderer.entity.RenderItem$1",
"net.minecraft.client.renderer.entity.RenderItem$2",
"net.minecraft.client.renderer.entity.RenderItem$3",
"net.minecraft.client.renderer.entity.RenderItem$4",
"net.minecraft.client.renderer.texture.TextureAtlasSprite$1",
"net.minecraft.client.renderer.texture.TextureManager$1",
"net.minecraft.client.renderer.texture.TextureMap$1",
"net.minecraft.client.renderer.texture.TextureMap$2",
"net.minecraft.client.renderer.texture.TextureMap$3"
};
String[] server = {
"net.minecraft.server.dedicated.DedicatedServer$3",
"net.minecraft.server.dedicated.DedicatedServer$4"
};
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
handlers = ObjectArrays.concat(handlers, client, String.class);
else
handlers = ObjectArrays.concat(handlers, server, String.class);
//FMLLog.info("Preloading CrashReport classes", ForgeVersion.getVersion());
for (String s : handlers)
{
//FMLLog.info("\t" + s);
try
{
Class<?> cls = Class.forName(s, false, MinecraftForge.class.getClassLoader());
if (cls != null && !Callable.class.isAssignableFrom(cls))
{
//FMLLog.info("\t% s is not a instance of callable!", s);
}
}
catch (Exception e){}
}
UsernameCache.load();
// Load before all the mods, so MC owns the MC fluids
FluidRegistry.validateFluidRegistry();
ForgeHooks.initTools();
//For all the normal CrashReport classes to be defined. We're in MC's classloader so this should all be fine
new CrashReport("ThisIsFake", new Exception("Not real"));
}
public static void preloadCrashClasses(ASMDataTable table, String modID, Set<String> classes)
{
//Find all ICrashReportDetail's handlers and preload them.
List<String> all = Lists.newArrayList();
for (ASMData asm : table.getAll(ICrashReportDetail.class.getName().replace('.', '/')))
all.add(asm.getClassName());
for (ASMData asm : table.getAll(ICrashCallable.class.getName().replace('.', '/')))
all.add(asm.getClassName());
all.retainAll(classes);
if (all.size() == 0)
return;
FMLLog.log(modID, Level.DEBUG, "Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all)
{
FMLLog.log(modID, Level.DEBUG, "\t" + name);
try
{
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
@@ -19,7 +19,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
public boolean isInput(ItemStack stack)
{
Item item = stack.getItem();
return item == Items.potionitem || item == Items.splash_potion || item == Items.lingering_potion || item == Items.glass_bottle;
return item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
}
/**
@@ -114,4 +114,11 @@ public final class CapabilityDispatcher implements INBTSerializable<NBTTagCompou
}
}
}
public boolean areCompatible(CapabilityDispatcher other) //Called from ItemStack to compare equality.
{ // Only compares serializeable caps.
if (other == null) return this.writers.length == 0; // Done this way so we can do some pre-checks before doing the costly NBT serialization and compare
if (this.writers.length == 0) return other.writers.length == 0;
return this.serializeNBT().equals(other.serializeNBT());
}
}
@@ -1,10 +1,10 @@
package net.minecraftforge.common.chunkio;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraft.world.gen.ChunkProviderServer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.ChunkPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkDataEvent;
@@ -78,8 +78,7 @@ class ChunkIOProvider implements Runnable
MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(this.chunk, this.nbt)); // Don't call ChunkDataEvent.Load async
this.chunk.setLastSaveTime(provider.worldObj.getTotalWorldTime());
provider.id2ChunkMap.add(ChunkCoordIntPair.chunkXZ2Int(this.chunkInfo.x, this.chunkInfo.z), this.chunk);
provider.loadedChunks.add(this.chunk);
provider.id2ChunkMap.put(ChunkPos.chunkXZ2Int(this.chunkInfo.x, this.chunkInfo.z), this.chunk);
this.chunk.onChunkLoad();
if (provider.chunkGenerator != null)
@@ -117,7 +117,7 @@ public class Configuration
File fileBak = new File(file.getAbsolutePath() + "_" +
new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored");
FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " +
"and a new config file will be generated.", file.getName(), fileBak.getName());
"and a new config file will be generated.", file.getName(), fileBak.getName());
e.printStackTrace();
file.renameTo(fileBak);
@@ -691,11 +691,6 @@ public class Configuration
*/
public Property get(String category, String key, String defaultValue, String comment, Property.Type type)
{
if (!caseSensitiveCustomCategories)
{
category = category.toLowerCase(Locale.ENGLISH);
}
ConfigCategory cat = getCategory(category);
if (cat.containsKey(key))
@@ -739,11 +734,6 @@ public class Configuration
*/
public Property get(String category, String key, String[] defaultValues, String comment, Property.Type type)
{
if (!caseSensitiveCustomCategories)
{
category = category.toLowerCase(Locale.ENGLISH);
}
ConfigCategory cat = getCategory(category);
if (cat.containsKey(key))
@@ -783,11 +773,15 @@ public class Configuration
public boolean hasCategory(String category)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
return categories.get(category) != null;
}
public boolean hasKey(String category, String key)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
ConfigCategory cat = categories.get(category);
return cat != null && cat.containsKey(key);
}
@@ -909,6 +903,8 @@ public class Configuration
if (tmpList != null) // allow special characters as part of string lists
break;
name = line.substring(nameStart, nameEnd + 1);
if (!caseSensitiveCustomCategories)
name = name.toLowerCase(Locale.ENGLISH);
String qualifiedName = ConfigCategory.getQualifiedName(name, currentCat);
ConfigCategory cat = categories.get(qualifiedName);
@@ -1122,6 +1118,9 @@ public class Configuration
public ConfigCategory getCategory(String category)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
ConfigCategory ret = categories.get(category);
if (ret == null)
@@ -1191,8 +1190,6 @@ public class Configuration
*/
public Configuration setCategoryComment(String category, String comment)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setComment(comment);
return this;
}
@@ -1210,8 +1207,6 @@ public class Configuration
*/
public Configuration setCategoryLanguageKey(String category, String langKey)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setLanguageKey(langKey);
return this;
}
@@ -1230,9 +1225,6 @@ public class Configuration
*/
public Configuration setCategoryConfigEntryClass(String category, Class<? extends IConfigEntry> clazz)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setConfigEntryClass(clazz);
return this;
}
@@ -1244,8 +1236,6 @@ public class Configuration
*/
public Configuration setCategoryRequiresWorldRestart(String category, boolean requiresWorldRestart)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setRequiresWorldRestart(requiresWorldRestart);
return this;
}
@@ -1258,8 +1248,6 @@ public class Configuration
*/
public Configuration setCategoryRequiresMcRestart(String category, boolean requiresMcRestart)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setRequiresMcRestart(requiresMcRestart);
return this;
}
@@ -1270,8 +1258,6 @@ public class Configuration
*/
public Configuration setCategoryPropertyOrder(String category, List<String> propOrder)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setPropertyOrder(propOrder);
return this;
}
@@ -0,0 +1,18 @@
package net.minecraftforge.common.model;
import com.google.common.collect.ImmutableList;
final class HiddenModelPart implements IModelPart
{
private final ImmutableList<String> path;
HiddenModelPart(ImmutableList<String> path)
{
this.path = path;
}
ImmutableList<String> getPath()
{
return path;
}
}
@@ -0,0 +1,24 @@
package net.minecraftforge.common.model;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterators;
import com.google.common.collect.UnmodifiableIterator;
public enum Models
{
;
public static IModelPart getHiddenModelPart(ImmutableList<String> path)
{
return new HiddenModelPart(path);
}
public static UnmodifiableIterator<String> getParts(IModelPart part)
{
if(part instanceof HiddenModelPart)
{
return ((HiddenModelPart) part).getPath().iterator();
}
return Iterators.emptyIterator();
}
}
@@ -78,7 +78,7 @@ public class ExtendedBlockState extends BlockStateContainer
{
if (!property.getAllowedValues().contains(value))
{
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(getBlock()) + ", it is not an allowed value");
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.REGISTRY.getNameForObject(getBlock()) + ", it is not an allowed value");
} else
{
if (this.getProperties().get(property) == value)
@@ -106,7 +106,7 @@ public class ExtendedBlockState extends BlockStateContainer
}
if(!property.isValid(value))
{
throw new IllegalArgumentException("Cannot set unlisted property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(getBlock()) + ", it is not an allowed value");
throw new IllegalArgumentException("Cannot set unlisted property " + property + " to " + value + " on block " + Block.REGISTRY.getNameForObject(getBlock()) + ", it is not an allowed value");
}
Map<IUnlistedProperty<?>, Optional<?>> newMap = new HashMap<IUnlistedProperty<?>, Optional<?>>(unlistedProperties);
newMap.put(property, Optional.fromNullable(value));
@@ -139,7 +139,7 @@ public class BlockSnapshot implements Serializable
public TileEntity getTileEntity()
{
if (getNbt() != null)
return TileEntity.createTileEntity(getWorld().getMinecraftServer(), getNbt());
return TileEntity.create(getNbt());
else return null;
}
@@ -1,10 +1,10 @@
package net.minecraftforge.common.util;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.util.math.ChunkPos;
// Sorter to load nearby chunks first
public class ChunkCoordComparator implements java.util.Comparator<ChunkCoordIntPair>
public class ChunkCoordComparator implements java.util.Comparator<ChunkPos>
{
private int x;
private int z;
@@ -15,7 +15,7 @@ public class ChunkCoordComparator implements java.util.Comparator<ChunkCoordIntP
z = (int) entityplayer.posZ >> 4;
}
public int compare(ChunkCoordIntPair a, ChunkCoordIntPair b)
public int compare(ChunkPos a, ChunkPos b)
{
if (a.equals(b))
{
@@ -13,7 +13,7 @@ import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.item.EntityPainting.EnumArt;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item.ToolMaterial;
@@ -38,7 +38,7 @@ public class EnumHelper
private static Class<?>[][] commonTypes =
{
{EnumAction.class},
{ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class},
{ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class, float.class},
{EnumArt.class, String.class, int.class, int.class, int.class, int.class},
{EnumCreatureAttribute.class},
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class},
@@ -47,7 +47,7 @@ public class EnumHelper
{Sensitivity.class},
{RayTraceResult.Type.class},
{EnumSkyBlock.class, int.class},
{EnumStatus.class},
{SleepResult.class},
{ToolMaterial.class, int.class, int.class, float.class, float.class, int.class},
{EnumRarity.class, TextFormatting.class, String.class}
};
@@ -56,9 +56,9 @@ public class EnumHelper
{
return addEnum(EnumAction.class, name);
}
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip)
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness)
{
return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip);
return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip, toughness);
}
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
{
@@ -92,9 +92,9 @@ public class EnumHelper
{
return addEnum(EnumSkyBlock.class, name, lightValue);
}
public static EnumStatus addStatus(String name)
public static SleepResult addStatus(String name)
{
return addEnum(EnumStatus.class, name);
return addEnum(SleepResult.class, name);
}
public static ToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability)
{
@@ -181,13 +181,13 @@ public class EnumHelper
blankField(enumClass, "enumConstants");
}
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{
setup();
return addEnum(commonTypes, enumType, enumName, paramValues);
}
public static <T extends Enum<? >> T addEnum(Class<?>[][] map, Class<T> enumType, String enumName, Object... paramValues)
protected static <T extends Enum<? >> T addEnum(Class<?>[][] map, Class<T> enumType, String enumName, Object... paramValues)
{
for (Class<?>[] lookup : map)
{
@@ -353,4 +353,4 @@ public class EnumHelper
setup();
}
}
}
}