infinity-craft/src/main/java/anvil/infinity/Infinity.java

128 lines
4.5 KiB
Java
Raw Normal View History

2019-05-08 20:20:27 +02:00
package anvil.infinity;
import anvil.infinity.compat.CompatHandler;
import anvil.infinity.config.ConfigHandler;
2019-05-19 00:26:11 +02:00
import anvil.infinity.networking.KillAbilityPackageHandler;
import anvil.infinity.networking.KillAbilityReturnPackageHandler;
import anvil.infinity.networking.PackageKillAbility;
import anvil.infinity.networking.PackageReq;
2019-05-08 20:20:27 +02:00
import net.minecraft.block.Block;
2019-05-19 00:26:11 +02:00
import net.minecraft.entity.player.EntityPlayerMP;
2019-05-08 20:20:27 +02:00
import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
2019-05-19 00:26:11 +02:00
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
2019-05-08 20:20:27 +02:00
import net.minecraftforge.fml.common.registry.GameRegistry;
2019-05-19 00:26:11 +02:00
import net.minecraftforge.fml.relauncher.Side;
2019-05-08 20:20:27 +02:00
//Test
@Mod(
modid = Infinity.MOD_ID,
name = Infinity.MOD_NAME,
version = Infinity.VERSION,
dependencies = Infinity.DEPENDENCIES
)
public class Infinity {
public static final String MOD_ID = "infinity";
public static final String MOD_NAME = "Infinityraft";
2019-05-13 10:38:25 +02:00
public static final String VERSION = "1.3";
2019-05-08 20:20:27 +02:00
public static final String DEPENDENCIES = "required-after:lucraftcore@[1.12.2-2.4.0,)";
2019-05-19 00:26:11 +02:00
public static final SimpleNetworkWrapper NETWORK_WRAPPER = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
2019-05-08 20:20:27 +02:00
/**
* This is the instance of your mod as created by Forge. It will never be null.
*/
@Mod.Instance(MOD_ID)
public static Infinity INSTANCE;
/**
* This is the first initialization event. Register tile entities here.
* The registry events below will have fired prior to entry to this method.
*/
@Mod.EventHandler
public void preinit(FMLPreInitializationEvent event) {
ConfigHandler.refreshConfig(event.getSuggestedConfigurationFile());
CompatHandler.check();
2019-05-19 00:26:11 +02:00
int netID = 0;
NETWORK_WRAPPER.registerMessage(KillAbilityReturnPackageHandler.class, PackageKillAbility.class, netID++, Side.SERVER);
NETWORK_WRAPPER.registerMessage(KillAbilityPackageHandler.class, PackageReq.class, netID++, Side.CLIENT);
2019-05-08 20:20:27 +02:00
}
/**
* This is the second initialization event. Register custom recipes
*/
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
}
/**
* This is the final initialization event. Register actions from other mods here
*/
@Mod.EventHandler
public void postinit(FMLPostInitializationEvent event) {
}
/**
* Forge will automatically look up and bind blocks to the fields in this class
* based on their registry name.
*/
@GameRegistry.ObjectHolder(MOD_ID)
public static class Blocks {
/*
public static final MySpecialBlock mySpecialBlock = null; // placeholder for special block below
*/
}
/**
* Forge will automatically look up and bind items to the fields in this class
* based on their registry name.
*/
@GameRegistry.ObjectHolder(MOD_ID)
public static class Items {
/*
public static final ItemBlock mySpecialBlock = null; // itemblock for the block above
public static final MySpecialItem mySpecialItem = null; // placeholder for special item below
*/
}
/**
* This is a special class that listens to registry events, to allow creation of mod blocks and items at the proper time.
*/
@Mod.EventBusSubscriber
public static class ObjectRegistryHandler {
/**
* Listen for the register event for creating custom items
*/
@SubscribeEvent
public static void addItems(RegistryEvent.Register<Item> event) {
/*
event.getRegistry().register(new ItemBlock(Blocks.myBlock).setRegistryName(MOD_ID, "myBlock"));
event.getRegistry().register(new MySpecialItem().setRegistryName(MOD_ID, "mySpecialItem"));
*/
}
/**
* Listen for the register event for creating custom blocks
*/
@SubscribeEvent
public static void addBlocks(RegistryEvent.Register<Block> event) {
/*
event.getRegistry().register(new MySpecialBlock().setRegistryName(MOD_ID, "mySpecialBlock"));
*/
}
}
}