mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Server starts
This commit is contained in:
1 parent
330db1a54d
commit
b50b768852
44 files changed
+449
-475
No files matched your search
@@ -28,7 +28,6 @@ import net.minecraftforge.client.CloudRenderer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
@@ -51,6 +50,7 @@ public class ForgeInternalHandler
|
||||
{
|
||||
ItemStack stack = ((EntityItem)entity).getItem();
|
||||
Item item = stack.getItem();
|
||||
/*
|
||||
if (item.hasCustomEntity(stack))
|
||||
{
|
||||
Entity newEntity = item.createEntity(event.getWorld(), entity, stack);
|
||||
@@ -61,6 +61,7 @@ public class ForgeInternalHandler
|
||||
event.getWorld().spawnEntity(newEntity);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,15 +33,12 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.WorldPersistenceHooks;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
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.INBTBase;
|
||||
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.common.config.ConfigCategory;
|
||||
@@ -49,16 +46,10 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.common.model.animation.CapabilityAnimation;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.RegistryEvent.MissingMappings;
|
||||
import net.minecraftforge.event.terraingen.DeferredBiomeDecorator;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.server.command.ForgeCommand;
|
||||
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
|
||||
@@ -118,10 +109,10 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
|
||||
}
|
||||
|
||||
public static Configuration getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
// public static Configuration getConfig()
|
||||
// {
|
||||
// return config;
|
||||
// }
|
||||
|
||||
private static void remapGeneralPropertyToClient(String key)
|
||||
{
|
||||
@@ -340,6 +331,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void missingMapping(RegistryEvent.MissingMappings<Item> event)
|
||||
{
|
||||
for (MissingMappings.Mapping<Item> entry : event.getAllMappings())
|
||||
@@ -351,10 +343,11 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
UsernameCache.setUsername(event.player.getPersistentID(), event.player.getGameProfile().getName());
|
||||
UsernameCache.setUsername(event.player.getUniqueID(), event.player.getGameProfile().getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -374,6 +367,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void registrItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
// Add and register the forge universal bucket, if it's enabled
|
||||
@@ -385,6 +379,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
MinecraftForge.EVENT_BUS.register(universalBucket);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void postInit(FMLPostInitializationEvent evt)
|
||||
{
|
||||
@@ -394,6 +389,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
|
||||
private static void registerAllBiomesAndGenerateEvents()
|
||||
{
|
||||
/*
|
||||
for (Biome biome : ForgeRegistries.BIOMES.getValuesCollection())
|
||||
{
|
||||
if (biome.decorator instanceof DeferredBiomeDecorator)
|
||||
@@ -404,16 +400,17 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
|
||||
BiomeDictionary.ensureHasTypes(biome);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void onAvailable(FMLLoadCompleteEvent evt)
|
||||
{
|
||||
FluidRegistry.validateFluidRegistry();
|
||||
// FluidRegistry.validateFluidRegistry();
|
||||
}
|
||||
|
||||
public void serverStarting(FMLServerStartingEvent evt)
|
||||
{
|
||||
evt.registerServerCommand(new ForgeCommand());
|
||||
|
||||
}
|
||||
|
||||
public void serverStopping(FMLServerStoppingEvent evt)
|
||||
@@ -432,7 +429,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, INBTBase> propertyMap, NBTTagCompound tag)
|
||||
public void readData(SaveHandler handler, WorldInfo info, NBTTagCompound tag)
|
||||
{
|
||||
DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null);
|
||||
FluidRegistry.loadFluidDefaults(tag);
|
||||
@@ -440,13 +437,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
|
||||
public void mappingChanged(FMLModIdMappingEvent evt)
|
||||
{
|
||||
OreDictionary.rebakeMap();
|
||||
StatList.reinit();
|
||||
Ingredient.invalidateAll();
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, ()-> () -> {
|
||||
Minecraft.getMinecraft().populateSearchTreeManager();
|
||||
Minecraft.getMinecraft().getSearchTreeManager().onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.ICrashCallable;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -35,7 +33,6 @@ import net.minecraft.crash.ICrashReportDetail;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeHooks.SeedEntry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
@@ -86,8 +83,6 @@ public class MinecraftForge
|
||||
{
|
||||
LOGGER.info(FORGE,"MinecraftForge v{} Initialized", ForgeVersion.getVersion());
|
||||
|
||||
OreDictionary.getOreName(0);
|
||||
|
||||
UsernameCache.load();
|
||||
// Load before all the mods, so MC owns the MC fluids
|
||||
FluidRegistry.validateFluidRegistry();
|
||||
@@ -100,6 +95,7 @@ public class MinecraftForge
|
||||
|
||||
|
||||
|
||||
/*
|
||||
public static void preloadCrashClasses(ASMDataTable table, String modID, Set<String> classes)
|
||||
{
|
||||
//Find all ICrashReportDetail's handlers and preload them.
|
||||
@@ -129,4 +125,5 @@ public class MinecraftForge
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -40,8 +40,8 @@ import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -50,9 +50,10 @@ import net.minecraftforge.common.animation.ITimeValue;
|
||||
import net.minecraftforge.common.animation.TimeValues;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.util.JsonUtils;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
@@ -67,6 +68,7 @@ import java.util.function.Function;
|
||||
|
||||
public final class AnimationStateMachine implements IAnimationStateMachine
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final ImmutableMap<String, ITimeValue> parameters;
|
||||
private final ImmutableMap<String, IClip> clips;
|
||||
private final ImmutableList<String> states;
|
||||
@@ -163,7 +165,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.log.error("Unknown special event \"{}\", ignoring.", event.event());
|
||||
LOGGER.error("Unknown special event \"{}\", ignoring.", event.event());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,7 +234,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
|
||||
}
|
||||
catch(IOException | JsonParseException e)
|
||||
{
|
||||
FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e);
|
||||
LOGGER.error("Exception loading Animation State Machine {}, skipping", location, e);
|
||||
return missing;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -21,7 +21,7 @@ package net.minecraftforge.common.model.animation;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
@@ -41,13 +41,13 @@ public class CapabilityAnimation
|
||||
CapabilityManager.INSTANCE.register(IAnimationStateMachine.class, new Capability.IStorage<IAnimationStateMachine>()
|
||||
{
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability<IAnimationStateMachine> capability, IAnimationStateMachine instance, EnumFacing side)
|
||||
public INBTBase writeNBT(Capability<IAnimationStateMachine> capability, IAnimationStateMachine instance, EnumFacing side)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability<IAnimationStateMachine> capability, IAnimationStateMachine instance, EnumFacing side, NBTBase nbt) {}
|
||||
public void readNBT(Capability<IAnimationStateMachine> capability, IAnimationStateMachine instance, EnumFacing side, INBTBase nbt) {}
|
||||
}, AnimationStateMachine::getMissing);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user