mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 23:13:15 +00:00
Zeroth pass on 1.13
This commit is contained in:
1 parent
6e99f84e91
commit
77c3310711
176 files changed
+603
-16145
No files matched your search
@@ -66,7 +66,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class DimensionManager
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker DIMMGR = MarkerManager.getMarker("DIMS");
|
||||
private static class Dimension
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.fml.ServerLifecycleHooks;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
@@ -170,7 +170,7 @@ import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
public class ForgeHooks
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker FORGEHOOKS = MarkerManager.getMarker("FORGEHOOKS");
|
||||
//TODO: Loot tables?
|
||||
static class SeedEntry extends WeightedRandom.Item
|
||||
|
||||
@@ -25,22 +25,21 @@ import net.minecraft.world.biome.Biome;
|
||||
import static net.minecraftforge.common.config.Configuration.CATEGORY_CLIENT;
|
||||
import static net.minecraftforge.common.config.Configuration.CATEGORY_GENERAL;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.SidedExecutor;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.WorldPersistenceHooks;
|
||||
import net.minecraftforge.fml.javafmlmod.ModLoadingContext;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.world.storage.SaveHandler;
|
||||
@@ -66,9 +65,7 @@ import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
@@ -76,7 +73,7 @@ import org.apache.logging.log4j.MarkerManager;
|
||||
public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
{
|
||||
public static final String VERSION_CHECK_CAT = "version_checking";
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD");
|
||||
public static int clumpingThreshold = 64;
|
||||
public static boolean removeErroringEntities = false;
|
||||
@@ -113,9 +110,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
public ForgeMod()
|
||||
{
|
||||
INSTANCE = this;
|
||||
ModLoadingContext.get().getModEventBus().addListener(this::preInit);
|
||||
ModLoadingContext.get().getModEventBus().addListener(this::postInit);
|
||||
ModLoadingContext.get().getModEventBus().addListener(this::onAvailable);
|
||||
FMLModLoadingContext.get().getModEventBus().addListener(this::preInit);
|
||||
FMLModLoadingContext.get().getModEventBus().addListener(this::postInit);
|
||||
FMLModLoadingContext.get().getModEventBus().addListener(this::onAvailable);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::playerLogin);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
|
||||
@@ -336,10 +333,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
|
||||
if (event.isWorldRunning() && tmpStairs != disableStairSlabCulling)
|
||||
{
|
||||
SidedExecutor.runOn(Dist.CLIENT,()->{
|
||||
Minecraft.getMinecraft().renderGlobal.loadRenderers();
|
||||
return null;
|
||||
});
|
||||
DistExecutor.runWhenOn(Dist.CLIENT,()->()-> Minecraft.getMinecraft().renderGlobal.loadRenderers());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -438,7 +432,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, INBTBase> propertyMap, NBTTagCompound tag)
|
||||
{
|
||||
DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null);
|
||||
FluidRegistry.loadFluidDefaults(tag);
|
||||
@@ -449,10 +443,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
OreDictionary.rebakeMap();
|
||||
StatList.reinit();
|
||||
Ingredient.invalidateAll();
|
||||
SidedExecutor.runOn(Dist.CLIENT, ()-> {
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, ()-> () -> {
|
||||
Minecraft.getMinecraft().populateSearchTreeManager();
|
||||
Minecraft.getMinecraft().getSearchTreeManager().onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MinecraftForge
|
||||
public static final IEventBus ORE_GEN_BUS = IEventBus.create();
|
||||
|
||||
static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker FORGE = MarkerManager.getMarker("FORGE");
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ package net.minecraftforge.common.brewing;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
import net.minecraft.potion.PotionBrewing;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||
@Override
|
||||
public boolean isIngredient(@Nonnull ItemStack stack)
|
||||
{
|
||||
return PotionHelper.isReagent(stack);
|
||||
return PotionBrewing.isReagent(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||
{
|
||||
if (!input.isEmpty() && !ingredient.isEmpty() && isIngredient(ingredient))
|
||||
{
|
||||
ItemStack result = PotionHelper.doReaction(ingredient, input);
|
||||
ItemStack result = PotionBrewing.doReaction(ingredient, input);
|
||||
if (result != input)
|
||||
{
|
||||
return result;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.concurrent.Callable;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -58,7 +58,7 @@ public class Capability<T>
|
||||
* @return a NBT holding the data. Null if no data needs to be stored.
|
||||
*/
|
||||
@Nullable
|
||||
NBTBase writeNBT(Capability<T> capability, T instance, EnumFacing side);
|
||||
INBTBase writeNBT(Capability<T> capability, T instance, EnumFacing side);
|
||||
|
||||
/**
|
||||
* Read the capability instance from a NBT tag.
|
||||
@@ -79,7 +79,7 @@ public class Capability<T>
|
||||
* @param side The side of the object the instance is associated with.
|
||||
* @param nbt A NBT holding the data. Must not be null, as doesn't make sense to call this function with nothing to read...
|
||||
*/
|
||||
void readNBT(Capability<T> capability, T instance, EnumFacing side, NBTBase nbt);
|
||||
void readNBT(Capability<T> capability, T instance, EnumFacing side, INBTBase nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ public class Capability<T>
|
||||
* Quick access to the IStorage's readNBT.
|
||||
* See {@link IStorage#readNBT(Capability, Object, EnumFacing, NBTBase)} for documentation.
|
||||
*/
|
||||
public void readNBT(T instance, EnumFacing side, NBTBase nbt)
|
||||
public void readNBT(T instance, EnumFacing side, INBTBase nbt)
|
||||
{
|
||||
storage.readNBT(this, instance, side, nbt);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class Capability<T>
|
||||
* See {@link IStorage#writeNBT(Capability, Object, EnumFacing)} for documentation.
|
||||
*/
|
||||
@Nullable
|
||||
public NBTBase writeNBT(T instance, EnumFacing side)
|
||||
public INBTBase writeNBT(T instance, EnumFacing side)
|
||||
{
|
||||
return storage.writeNBT(this, instance, side);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -45,7 +45,7 @@ import net.minecraftforge.common.util.INBTSerializable;
|
||||
public final class CapabilityDispatcher implements INBTSerializable<NBTTagCompound>, ICapabilityProvider
|
||||
{
|
||||
private ICapabilityProvider[] caps;
|
||||
private INBTSerializable<NBTBase>[] writers;
|
||||
private INBTSerializable<INBTBase>[] writers;
|
||||
private String[] names;
|
||||
|
||||
public CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list)
|
||||
@@ -57,7 +57,7 @@ public final class CapabilityDispatcher implements INBTSerializable<NBTTagCompou
|
||||
public CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, @Nullable ICapabilityProvider parent)
|
||||
{
|
||||
List<ICapabilityProvider> lstCaps = Lists.newArrayList();
|
||||
List<INBTSerializable<NBTBase>> lstWriters = Lists.newArrayList();
|
||||
List<INBTSerializable<INBTBase>> lstWriters = Lists.newArrayList();
|
||||
List<String> lstNames = Lists.newArrayList();
|
||||
|
||||
if (parent != null) // Parents go first!
|
||||
@@ -65,7 +65,7 @@ public final class CapabilityDispatcher implements INBTSerializable<NBTTagCompou
|
||||
lstCaps.add(parent);
|
||||
if (parent instanceof INBTSerializable)
|
||||
{
|
||||
lstWriters.add((INBTSerializable<NBTBase>)parent);
|
||||
lstWriters.add((INBTSerializable<INBTBase>)parent);
|
||||
lstNames.add("Parent");
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public final class CapabilityDispatcher implements INBTSerializable<NBTTagCompou
|
||||
lstCaps.add(prov);
|
||||
if (prov instanceof INBTSerializable)
|
||||
{
|
||||
lstWriters.add((INBTSerializable<NBTBase>)prov);
|
||||
lstWriters.add((INBTSerializable<INBTBase>)prov);
|
||||
lstNames.add(entry.getKey().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import static net.minecraftforge.fml.Logging.CAPABILITIES;
|
||||
public enum CapabilityManager
|
||||
{
|
||||
INSTANCE;
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
/**
|
||||
* Registers a capability to be consumed by others.
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package net.minecraftforge.common.capabilities;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraftforge.common.util.INBTSerializable;
|
||||
|
||||
//Just a mix of the two, useful in patches to lower the size.
|
||||
public interface ICapabilitySerializable<T extends NBTBase> extends ICapabilityProvider, INBTSerializable<T>{}
|
||||
public interface ICapabilitySerializable<T extends INBTBase> extends ICapabilityProvider, INBTSerializable<T>{}
|
||||
@@ -37,7 +37,7 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.util.RecipeBookClient;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.SidedExecutor;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
@@ -81,7 +81,7 @@ import org.apache.logging.log4j.MarkerManager;
|
||||
public class CraftingHelper {
|
||||
|
||||
private static final boolean DEBUG_LOAD_MINECRAFT = false;
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker CRAFTHELPER = MarkerManager.getMarker("CRAFTHELPER");
|
||||
private static Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
private static Map<ResourceLocation, IConditionFactory> conditions = new HashMap<>();
|
||||
@@ -619,10 +619,7 @@ public class CraftingHelper {
|
||||
GameData.fireRegistryEvents(rl -> rl.equals(GameData.RECIPES));
|
||||
|
||||
//reg.freeze();
|
||||
SidedExecutor.runOn(Dist.CLIENT, ()-> {
|
||||
RecipeBookClient.rebuildTable();
|
||||
return null;
|
||||
});
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, ()-> RecipeBookClient::rebuildTable);
|
||||
}
|
||||
|
||||
private static void loadFactories(final ModFile modFile)
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
|
||||
/**
|
||||
* An interface designed to unify various things in the Minecraft
|
||||
* code base that can be serialized to and from a NBT tag.
|
||||
*/
|
||||
public interface INBTSerializable<T extends NBTBase>
|
||||
public interface INBTSerializable<T extends INBTBase>
|
||||
{
|
||||
T serializeNBT();
|
||||
void deserializeNBT(T nbt);
|
||||
|
||||
Reference in new issue
Block a user