mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-24 22:14:32 +00:00
1.9.4 Update.
Major things to note: Class renames: https://gist.github.com/LexManos/44dd211f90f498ad4015279b103dff86 Tile Entities are now packed in the ChunkData packet. Forge intends to work around this to better support large moded worlds, but for the time being modders should implement the new function carefully and only send what data they need to! Minecraft's codebase now has annotations, these are directly from Mojang and should be adheared to! Added support for package-info.java's containing @Nullable information for all MC code base.
This commit is contained in:
1 parent
5d5c005aae
commit
b9ac73b0f1
257 files changed
+2398
-1919
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 type the type 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.biomeRegistry.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.biomeRegistry.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.biomeRegistry.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.biomeRegistry.getKeys())
|
||||
{
|
||||
Biome biome = Biome.biomeRegistry.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)
|
||||
{
|
||||
@@ -393,12 +393,12 @@ public class BiomeDictionary
|
||||
}
|
||||
|
||||
//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.biomeRegistry.getNameForObject(biome));
|
||||
}
|
||||
|
||||
private static void checkRegistration(BiomeGenBase biome)
|
||||
|
||||
private static void checkRegistration(Biome biome)
|
||||
{
|
||||
if(!isBiomeRegistered(biome))
|
||||
{
|
||||
|
||||
@@ -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,10 +18,10 @@ 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
|
||||
{
|
||||
@@ -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))
|
||||
{
|
||||
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
||||
ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.villageSpawnBiomes);
|
||||
biomes.add(biome);
|
||||
MapGenVillage.villageSpawnBiomes = biomes;
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeVillageBiome(BiomeGenBase biome)
|
||||
public static void removeVillageBiome(Biome biome)
|
||||
{
|
||||
if (MapGenVillage.villageSpawnBiomes.contains(biome))
|
||||
{
|
||||
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
||||
ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.villageSpawnBiomes);
|
||||
biomes.remove(biome);
|
||||
MapGenVillage.villageSpawnBiomes = 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ public class ForgeHooks
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
if (tileentity != null)
|
||||
{
|
||||
Packet<?> pkt = tileentity.getDescriptionPacket();
|
||||
Packet<?> pkt = tileentity.func_189518_D_();
|
||||
if (pkt != null)
|
||||
{
|
||||
entityPlayer.playerNetServerHandler.sendPacket(pkt);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BlockSnapshot implements Serializable
|
||||
if (te != null)
|
||||
{
|
||||
nbt = new NBTTagCompound();
|
||||
te.writeToNBT(getNbt());
|
||||
te.func_189515_b(getNbt());
|
||||
}
|
||||
else nbt = null;
|
||||
if (DEBUG)
|
||||
@@ -139,7 +139,7 @@ public class BlockSnapshot implements Serializable
|
||||
public TileEntity getTileEntity()
|
||||
{
|
||||
if (getNbt() != null)
|
||||
return TileEntity.createTileEntity(getWorld().getMinecraftServer(), getNbt());
|
||||
return TileEntity.func_189514_c(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;
|
||||
@@ -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}
|
||||
};
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user