Refactored event handlers

This commit is contained in:
LemADEC 2015-08-30 18:05:30 +02:00
parent 1fb1033499
commit 2aed9b8b50
5 changed files with 716 additions and 701 deletions

View file

@ -7,11 +7,8 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommandSender;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@ -26,9 +23,6 @@ import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.FMLCommonHandler;
@ -96,11 +90,14 @@ import cr0s.warpdrive.command.CommandGenerate;
import cr0s.warpdrive.command.CommandInvisible;
import cr0s.warpdrive.command.CommandJumpgates;
import cr0s.warpdrive.command.CommandSpace;
import cr0s.warpdrive.config.Recipes;
import cr0s.warpdrive.config.WarpDriveConfig;
import cr0s.warpdrive.data.CamerasRegistry;
import cr0s.warpdrive.data.CloakManager;
import cr0s.warpdrive.data.JumpgatesRegistry;
import cr0s.warpdrive.data.StarMapRegistry;
import cr0s.warpdrive.event.LivingHandler;
import cr0s.warpdrive.event.WorldHandler;
import cr0s.warpdrive.item.ItemAirCanisterFull;
import cr0s.warpdrive.item.ItemComponent;
import cr0s.warpdrive.item.ItemHelmet;
@ -190,10 +187,10 @@ public class WarpDrive implements LoadingCallback {
public static Logger logger;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
public void onFMLPreInitialization(FMLPreInitializationEvent event) {
logger = event.getModLog();
WarpDriveConfig.preInit(event.getModConfigurationDirectory().getAbsolutePath());
WarpDriveConfig.onFMLpreInitialization(event.getModConfigurationDirectory().getAbsolutePath());
if (FMLCommonHandler.instance().getSide().isClient()) {
MinecraftForge.EVENT_BUS.register(new RenderOverlayCamera(Minecraft.getMinecraft()));
@ -203,13 +200,10 @@ public class WarpDrive implements LoadingCallback {
}
@EventHandler
public void init(FMLInitializationEvent event) {
public void onFMLInitialization(FMLInitializationEvent event) {
PacketHandler.init();
}
@EventHandler
public void load(FMLInitializationEvent event) {
WarpDriveConfig.load();
WarpDriveConfig.onFMLInitialization();
// CORE CONTROLLER
blockShipController = new BlockShipController(0, Material.rock);
@ -386,6 +380,7 @@ public class WarpDrive implements LoadingCallback {
proxy.registerEntities();
ForgeChunkManager.setForcedChunkLoadingCallback(instance, instance);
spaceWorldGenerator = new SpaceWorldGenerator();
@ -393,14 +388,49 @@ public class WarpDrive implements LoadingCallback {
hyperSpaceWorldGenerator = new HyperSpaceWorldGenerator();
GameRegistry.registerWorldGenerator(hyperSpaceWorldGenerator, 0);
registerSpaceDimension();
registerHyperSpaceDimension();
spaceBiome = (new BiomeSpace(WarpDriveConfig.G_SPACE_BIOME_ID)).setColor(0).setDisableRain().setBiomeName("Space");
BiomeDictionary.registerBiomeType(spaceBiome, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.WASTELAND);
DimensionManager.registerProviderType(WarpDriveConfig.G_SPACE_PROVIDER_ID, SpaceWorldProvider.class, true);
DimensionManager.registerDimension(WarpDriveConfig.G_SPACE_DIMENSION_ID, WarpDriveConfig.G_SPACE_PROVIDER_ID);
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
DimensionManager.registerProviderType(WarpDriveConfig.G_HYPERSPACE_PROVIDER_ID, HyperSpaceWorldProvider.class, true);
DimensionManager.registerDimension(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID, WarpDriveConfig.G_HYPERSPACE_PROVIDER_ID);
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
creativeTabWarpDrive.setBackgroundImageName("items.png");
}
}
@EventHandler
public void onFMLPostInitialization(FMLPostInitializationEvent event) {
space = DimensionManager.getWorld(WarpDriveConfig.G_SPACE_DIMENSION_ID);
hyperSpace = DimensionManager.getWorld(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID);
WarpDriveConfig.postInit();
if (WarpDriveConfig.isIndustrialCraft2loaded && WarpDriveConfig.RECIPES_ENABLE_IC2) {
Recipes.initIC2();
}
if (WarpDriveConfig.isIndustrialCraft2loaded && WarpDriveConfig.RECIPES_ENABLE_HARD_IC2) {
Recipes.initHardIC2();
}
if (WarpDriveConfig.RECIPES_ENABLE_VANILLA) {
Recipes.initVanilla();
}
// Registers
starMap = new StarMapRegistry();
jumpgates = new JumpgatesRegistry();
cloaks = new CloakManager();
cameras = new CamerasRegistry();
// Event handlers
WorldHandler worldHandler = new WorldHandler();
MinecraftForge.EVENT_BUS.register(worldHandler);
FMLCommonHandler.instance().bus().register(worldHandler);
MinecraftForge.EVENT_BUS.register(new LivingHandler());
if (WarpDriveConfig.isComputerCraftLoaded) {
peripheralHandler = new WarpDrivePeripheralHandler();
peripheralHandler.register();
@ -408,481 +438,8 @@ public class WarpDrive implements LoadingCallback {
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
space = DimensionManager.getWorld(WarpDriveConfig.G_SPACE_DIMENSION_ID);
hyperSpace = DimensionManager.getWorld(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID);
WarpDriveConfig.postInit();
if (WarpDriveConfig.isIndustrialCraft2loaded && WarpDriveConfig.RECIPES_ENABLE_IC2) {
initIC2Recipes();
}
if (WarpDriveConfig.isIndustrialCraft2loaded && WarpDriveConfig.RECIPES_ENABLE_HARD_IC2) {
initHardIC2Recipes();
}
if (WarpDriveConfig.RECIPES_ENABLE_VANILLA) {
initVanillaRecipes();
}
starMap = new StarMapRegistry();
jumpgates = new JumpgatesRegistry();
cloaks = new CloakManager();
cameras = new CamerasRegistry();
EventListeners watcher = new EventListeners();
MinecraftForge.EVENT_BUS.register(watcher);
FMLCommonHandler.instance().bus().register(watcher);
}
private static void initVanillaRecipes() {
itemComponent.registerRecipes();
blockDecorative.initRecipes();
itemUpgrade.initRecipes();
// WarpCore
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockShipCore), false, "ipi", "ici", "idi",
'i', Items.iron_ingot,
'p', itemComponent.getItemStack(6),
'c', itemComponent.getItemStack(2),
'd', Items.diamond));
// Controller
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockShipController), false, "ici", "idi", "iii",
'i', Items.iron_ingot,
'c', itemComponent.getItemStack(5),
'd', Items.diamond));
// Radar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockRadar), false, "ggg", "pdc", "iii",
'i', Items.iron_ingot,
'c', itemComponent.getItemStack(5),
'p', itemComponent.getItemStack(6),
'g', Blocks.glass,
'd', Items.diamond));
// Isolation Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWarpIsolation), false, "igi", "geg", "igi",
'i', Items.iron_ingot,
'g', Blocks.glass,
'e', Items.ender_pearl));
// Air generator
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockAirGenerator), false, "ibi", "i i", "ipi",
'i', Items.iron_ingot,
'b', Blocks.iron_bars,
'p', itemComponent.getItemStack(6)));
// Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaser), false, "ili", "iri", "ici",
'i', Items.iron_ingot,
'r', Items.redstone,
'c', itemComponent.getItemStack(5),
'l', itemComponent.getItemStack(3),
'p', itemComponent.getItemStack(6)));
// Mining laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMiningLaser), false, "ici", "iti", "ili",
'i', Items.iron_ingot,
'r', Items.redstone,
't', itemComponent.getItemStack(1),
'c', itemComponent.getItemStack(5),
'l', itemComponent.getItemStack(3)));
// Tree farm laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaserTreeFarm), false, "ili", "sts", "ici",
'i', Items.iron_ingot,
's', "treeSapling",
't', itemComponent.getItemStack(1),
'c', itemComponent.getItemStack(5),
'l', itemComponent.getItemStack(3)));
// Laser Lift
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLift), false, "ipi", "rtr", "ili",
'i', Items.iron_ingot,
'r', Items.redstone,
't', itemComponent.getItemStack(1),
'l', itemComponent.getItemStack(3),
'p', itemComponent.getItemStack(6)));
// Transporter
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockTransporter), false, "iii", "ptc", "iii",
'i', Items.iron_ingot,
't', itemComponent.getItemStack(1),
'c', itemComponent.getItemStack(5),
'p', itemComponent.getItemStack(6)));
// Particle Booster
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaserMedium), false, "ipi", "rgr", "iii",
'i', Items.iron_ingot,
'r', Items.redstone,
'g', Blocks.glass,
'p', itemComponent.getItemStack(6)));
// Camera
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCamera), false, "ngn", "i i", "ici",
'i', Items.iron_ingot,
'n', Items.gold_nugget,
'g', Blocks.glass,
'c', itemComponent.getItemStack(5)));
// LaserCamera
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockLaserCamera), blockCamera, blockLaser));
// Monitor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMonitor), false, "ggg", "iti", "ici",
'i', Items.iron_ingot,
't', Blocks.torch,
'g', Blocks.glass,
'c', itemComponent.getItemStack(5)));
// Cloaking device
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCloakingCore), false, "ipi", "lrl", "ici",
'i', Items.iron_ingot,
'r', Items.redstone,
'l', itemComponent.getItemStack(3),
'c', itemComponent.getItemStack(5),
'p', itemComponent.getItemStack(6)));
// Cloaking coil
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCloakingCoil), false, "ini", "rdr", "ini",
'i', Items.iron_ingot,
'd', Items.diamond,
'r', Items.redstone,
'n', Items.gold_nugget));
// Power Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockEnanReactorLaser), false, "iii", "ilg", "ici",
'i', Items.iron_ingot,
'g', Blocks.glass,
'c', itemComponent.getItemStack(5),
'l', itemComponent.getItemStack(3)));
// Power Reactor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockEnanReactorCore), false, "ipi", "gog", "ici",
'i', Items.iron_ingot,
'g', Blocks.glass,
'o', itemComponent.getItemStack(4),
'c', itemComponent.getItemStack(5),
'p', itemComponent.getItemStack(6)));
// Power Store
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockEnergyBank), false, "ipi", "isi", "ici",
'i', Items.iron_ingot,
's', itemComponent.getItemStack(7),
'c', itemComponent.getItemStack(5),
'p', itemComponent.getItemStack(6)));
// Transport Beacon
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockTransportBeacon), false, " e ", "ldl", " s ",
'e', Items.ender_pearl,
'l', "dyeBlue",
'd', Items.diamond,
's', Items.stick));
// Chunk Loader
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockChunkLoader), false, "ipi", "ici", "ifi",
'i', Items.iron_ingot,
'p', itemComponent .getItemStack(6),
'c', itemComponent.getItemStack(0),
'f', itemComponent.getItemStack(5)));
// Helmet
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemHelmet), false, "iii", "iwi", "gcg",
'i', Items.iron_ingot,
'w', Blocks.wool,
'g', Blocks.glass,
'c', itemComponent.getItemStack(8)));
}
private static void initIC2Recipes() {
ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1).copy();
ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1).copy();
ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12).copy();
ItemStack miner = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 7).copy();
ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9).copy();
ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9).copy();
ItemStack circuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuit", -1).copy();
ItemStack advancedCircuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuitAdv", -1).copy();
ItemStack ironPlate = WarpDriveConfig.getModItemStack("IC2", "itemPlates", 4).copy();
ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1).copy();
GameRegistry.addRecipe(new ItemStack(blockShipCore), "ici", "cmc", "ici",
'i', iridiumAlloy,
'm', advancedMachine,
'c', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(blockShipController), "iic", "imi", "cii",
'i', iridiumAlloy,
'm', advancedMachine,
'c', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(blockRadar), "ifi", "imi", "imi",
'i', iridiumAlloy,
'm', advancedMachine,
'f', WarpDriveConfig.getModItemStack("IC2", "itemFreq", -1));
GameRegistry.addRecipe(new ItemStack(blockWarpIsolation), "iii", "idi", "iii",
'i', WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1),
'm', advancedMachine,
'd', Blocks.diamond_block);
GameRegistry.addRecipe(new ItemStack(blockAirGenerator), "lcl", "lml", "lll",
'l', Blocks.leaves,
'm', advancedMachine,
'c', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(blockLaser), "sss", "ama", "aaa",
'm', advancedMachine,
'a', advancedAlloy,
's', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(blockMiningLaser), "aaa", "ama", "ccc",
'c', advancedCircuit,
'a', advancedAlloy,
'm', miner);
GameRegistry.addRecipe(new ItemStack(blockLaserMedium), "afc", "ama", "cfa",
'c', advancedCircuit,
'a', advancedAlloy,
'f', fiberGlassCable,
'm', mfe);
GameRegistry.addRecipe(new ItemStack(blockLift), "aca", "ama", "a#a",
'c', advancedCircuit,
'a', WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1),
'm', magnetizer);
GameRegistry.addRecipe(new ItemStack(blockIridium), "iii", "iii", "iii",
'i', iridiumAlloy);
GameRegistry.addShapelessRecipe(new ItemStack(iridiumAlloy.getItem(), 9), new ItemStack(blockIridium));
GameRegistry.addRecipe(new ItemStack(blockLaserCamera), "imi", "cec", "#k#",
'i', iridiumAlloy,
'm', advancedMachine,
'c', advancedCircuit,
'e', blockLaser,
'k', blockCamera);
GameRegistry.addRecipe(new ItemStack(blockCamera), "cgc", "gmg", "cgc",
'm', advancedMachine,
'c', advancedCircuit,
'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(blockMonitor), "gcg", "gmg", "ggg",
'm', advancedMachine,
'c', advancedCircuit,
'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(blockShipScanner), "sgs", "mma", "amm",
'm', advancedMachine,
'a', advancedAlloy,
's', advancedCircuit,
'g', Blocks.glass);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaserTreeFarm), false, new Object[] { "cwc", "wmw", "cwc",
'c', circuit,
'w', "logWood",
'm', blockMiningLaser }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockTransporter), false, new Object[] { "ece", "imi", "iei",
'e', Items.ender_pearl,
'c', circuit,
'i', ironPlate,
'm', advancedMachine }));
if (WarpDriveConfig.isIndustrialCraft2loaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemIC2reactorLaserFocus), false, new Object[] { " p ", "pdp", " p ",
'p', ironPlate,
'd', "gemDiamond" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockIC2reactorLaserMonitor), false, new Object[] { "pdp", "dmd", "pdp",
'p', ironPlate,
'd', "gemDiamond",
'm', mfe }));
}
GameRegistry.addRecipe(new ItemStack(blockCloakingCore), "imi", "mcm", "imi",
'i', blockIridium,
'c', blockCloakingCoil,
'm', advancedMachine);
GameRegistry.addRecipe(new ItemStack(blockCloakingCoil), "iai", "aca", "iai",
'i', iridiumAlloy,
'c', advancedCircuit,
'a', advancedAlloy);
}
private static void initHardIC2Recipes() {
ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1).copy();
ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1).copy();
ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12).copy();
ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9).copy();
ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9).copy();
ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1).copy();
ItemStack mfsu = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 2).copy();
ItemStack energiumDust = WarpDriveConfig.getModItemStack("IC2", "itemDust2", 2).copy();
ItemStack crystalmemory = WarpDriveConfig.getModItemStack("IC2", "itemcrystalmemory", -1).copy();
ItemStack itemHAMachine = new ItemStack(blockHighlyAdvancedMachine).copy();
GameRegistry.addRecipe(new ItemStack(blockShipCore),"uau", "tmt", "uau",
'a', advancedAlloy,
't', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 0), // Teleporter
'm', itemHAMachine,
'u', mfsu);
if (WarpDriveConfig.isOpenComputersLoaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockShipController), false, new Object[] { "aha", "cmc", "apa", // With OC Adapter
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'h', crystalmemory,
'p', WarpDriveConfig.getModItemStack("OpenComputers", "adapter", -1)}));
} else if (WarpDriveConfig.isComputerCraftLoaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockShipController), false, new Object[] { "aha", "cmc", "apa", // With CC Modem
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'h', crystalmemory,
'p', WarpDriveConfig.getModItemStack("ComputerCraft", "CC-Cable", 1)}));
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockShipController), false, new Object[] { "aha", "cmc", "aca",
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'h', crystalmemory}));
}
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockRadar), false, new Object[] { "afa", "cmc", "aca",
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'f', WarpDriveConfig.getModItemStack("IC2", "itemFreq", -1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWarpIsolation), false, new Object[] { "sls", "lml", "sls",
's', "plateDenseSteel",
'l', "plateDenseLead",
'm', itemHAMachine}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockAirGenerator), false, new Object[] { "lel", "vmv", "lcl",
'l', Blocks.leaves,
'm', WarpDriveConfig.getModItemStack("IC2", "blockMachine", 0),
'c', "circuitBasic",
'e', WarpDriveConfig.getModItemStack("IC2", "blockMachine", 5), // Compressor
'v', WarpDriveConfig.getModItemStack("IC2", "reactorVent", -1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaser), false, new Object[] { "aca", "cmc", "ala",
'm', advancedMachine,
'a', advancedAlloy,
'c', "circuitAdvanced",
'l', WarpDriveConfig.getModItemStack("IC2", "itemToolMiningLaser", -1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMiningLaser), false, new Object[] { "pcp", "pap", "plp",
'c', "circuitAdvanced",
'p', advancedAlloy,
'a', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 11), // Advanced Miner
'l', blockLaser}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaserMedium), false, new Object[] { "efe", "aca", "ama",
'c', "circuitAdvanced",
'a', advancedAlloy,
'f', fiberGlassCable,
'e', energiumDust,
'm', mfe}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLift), false, new Object[] { "aca", "ama", "aea",
'c', "circuitAdvanced",
'a', advancedAlloy,
'm', magnetizer,
'e', energiumDust}));
GameRegistry.addRecipe(new ItemStack(blockIridium), "iii", "iii", "iii",
'i', iridiumAlloy);
GameRegistry.addShapelessRecipe(new ItemStack(iridiumAlloy.getItem(), 9), new ItemStack(blockIridium));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaserCamera), false, new Object[] { "ala", "sss", "aca",
'a', advancedAlloy,
's', "circuitAdvanced",
'l', blockLaser,
'c', blockCamera}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCamera), false, new Object[] { "aed", "cma", "aga",
'a', advancedAlloy,
'e', WarpDriveConfig.getModItemStack("IC2", "itemRecipePart", 1), // Electric Motor
'd', "gemDiamond",
'c', crystalmemory,
'm', advancedMachine,
'g', WarpDriveConfig.getModItemStack("IC2", "itemCable", 2)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMonitor), false, new Object[] { "ala", "aca", "aga",
'a', advancedAlloy,
'l', Blocks.redstone_lamp,
'c', "circuitAdvanced",
'g', "paneGlassColorless" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockShipScanner), false, new Object[] { "ici", "isi", "mcm",
'm', mfsu,
'i', iridiumAlloy,
'c', "circuitAdvanced",
's', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 7) })); // Scanner
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockLaserTreeFarm), false, new Object[] { "awa", "cmc", "asa",
'a', advancedAlloy,
'c', "circuitAdvanced",
'w', "logWood",
'm', blockMiningLaser,
's', WarpDriveConfig.getModItemStack("IC2", "itemToolChainsaw", -1) }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockTransporter), false, new Object[] { "aea", "ctc", "ama",
'a', advancedAlloy,
'e', Items.ender_pearl,
'c', "circuitAdvanced",
'm', advancedMachine,
't', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 0) })); // Teleporter
// IC2 is loaded for this recipe set
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemIC2reactorLaserFocus), false, new Object[] { "a a", " d ", "a a",
'a', advancedAlloy,
'd', "gemDiamond" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockIC2reactorLaserMonitor), false, new Object[] { "pdp", "dmd", "pdp",
'p', advancedAlloy,
'd', "gemDiamond",
'm', mfe }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCloakingCore), false, new Object[] { "ici", "cmc", "igi",
'i', blockIridium,
'c', blockCloakingCoil,
'm', blockHighlyAdvancedMachine,
'g', "circuitAdvanced" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCloakingCoil), false, new Object[] { "iai", "ccc", "iai",
'i', iridiumAlloy,
'c', WarpDriveConfig.getModItemStack("IC2", "itemRecipePart", 0), // Coil
'a', advancedAlloy }));
GameRegistry.addRecipe(new ItemStack(blockHighlyAdvancedMachine), "iii", "imi", "iii",
'i', iridiumAlloy,
'm', advancedMachine);
}
private static void registerSpaceDimension() {
spaceBiome = (new BiomeSpace(WarpDriveConfig.G_SPACE_BIOME_ID)).setColor(0).setDisableRain().setBiomeName("Space");
BiomeDictionary.registerBiomeType(spaceBiome, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.WASTELAND);
DimensionManager.registerProviderType(WarpDriveConfig.G_SPACE_PROVIDER_ID, SpaceWorldProvider.class, true);
DimensionManager.registerDimension(WarpDriveConfig.G_SPACE_DIMENSION_ID, WarpDriveConfig.G_SPACE_PROVIDER_ID);
}
private static void registerHyperSpaceDimension() {
DimensionManager.registerProviderType(WarpDriveConfig.G_HYPERSPACE_PROVIDER_ID, HyperSpaceWorldProvider.class, true);
DimensionManager.registerDimension(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID, WarpDriveConfig.G_HYPERSPACE_PROVIDER_ID);
}
@EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
WarpDrive.logger.info("onServerStarting");
public void onFMLServerStarting(FMLServerStartingEvent event) {
WarpDrive.logger.info("onFMLServerStarting");
event.registerServerCommand(new CommandGenerate());
event.registerServerCommand(new CommandSpace());
event.registerServerCommand(new CommandInvisible());
@ -890,14 +447,14 @@ public class WarpDrive implements LoadingCallback {
event.registerServerCommand(new CommandDebug());
}
public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading te, boolean refreshLoading) {
World worldObj = te.getWorldObj();
public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading tileEntity, boolean refreshLoading) {
World worldObj = tileEntity.getWorldObj();
if (ForgeChunkManager.ticketCountAvailableFor(this, worldObj) > 0) {
Ticket t = ForgeChunkManager.requestTicket(this, worldObj, Type.NORMAL);
if (t != null) {
te.giveTicket(t); // FIXME calling the caller is a bad idea
tileEntity.giveTicket(t); // FIXME calling the caller is a bad idea
if (refreshLoading)
te.refreshLoading();
tileEntity.refreshLoading();
return t;
} else {
WarpDrive.logger.error("Ticket not granted");
@ -951,8 +508,9 @@ public class WarpDrive implements LoadingCallback {
sender.addChatMessage(new ChatComponentText(line));
}
}
@Mod.EventHandler
public void remap(FMLMissingMappingsEvent event) {
public void onFMLMissingMappings(FMLMissingMappingsEvent event) {
for (FMLMissingMappingsEvent.MissingMapping mapping: event.get()) {
if (mapping.type == GameRegistry.Type.ITEM) {
if (mapping.name.equals("WarpDrive:airBlock")) {

View file

@ -0,0 +1,451 @@
package cr0s.warpdrive.config;
import cpw.mods.fml.common.registry.GameRegistry;
import cr0s.warpdrive.WarpDrive;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
/**
* Hold the different recipe sets
*
* @author LemADEC
*
*/
public class Recipes {
public static void initVanilla() {
WarpDrive.itemComponent.registerRecipes();
WarpDrive.blockDecorative.initRecipes();
WarpDrive.itemUpgrade.initRecipes();
// WarpCore
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipCore), false, "ipi", "ici", "idi",
'i', Items.iron_ingot,
'p', WarpDrive.itemComponent.getItemStack(6),
'c', WarpDrive.itemComponent.getItemStack(2),
'd', Items.diamond));
// Controller
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipController), false, "ici", "idi", "iii",
'i', Items.iron_ingot,
'c', WarpDrive.itemComponent.getItemStack(5),
'd', Items.diamond));
// Radar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockRadar), false, "ggg", "pdc", "iii",
'i', Items.iron_ingot,
'c', WarpDrive.itemComponent.getItemStack(5),
'p', WarpDrive.itemComponent.getItemStack(6),
'g', Blocks.glass,
'd', Items.diamond));
// Isolation Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockWarpIsolation), false, "igi", "geg", "igi",
'i', Items.iron_ingot,
'g', Blocks.glass,
'e', Items.ender_pearl));
// Air generator
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockAirGenerator), false, "ibi", "i i", "ipi",
'i', Items.iron_ingot,
'b', Blocks.iron_bars,
'p', WarpDrive.itemComponent.getItemStack(6)));
// Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaser), false, "ili", "iri", "ici",
'i', Items.iron_ingot,
'r', Items.redstone,
'c', WarpDrive.itemComponent.getItemStack(5),
'l', WarpDrive.itemComponent.getItemStack(3),
'p', WarpDrive.itemComponent.getItemStack(6)));
// Mining laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockMiningLaser), false, "ici", "iti", "ili",
'i', Items.iron_ingot,
'r', Items.redstone,
't', WarpDrive.itemComponent.getItemStack(1),
'c', WarpDrive.itemComponent.getItemStack(5),
'l', WarpDrive.itemComponent.getItemStack(3)));
// Tree farm laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaserTreeFarm), false, "ili", "sts", "ici",
'i', Items.iron_ingot,
's', "treeSapling",
't', WarpDrive.itemComponent.getItemStack(1),
'c', WarpDrive.itemComponent.getItemStack(5),
'l', WarpDrive.itemComponent.getItemStack(3)));
// Laser Lift
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLift), false, "ipi", "rtr", "ili",
'i', Items.iron_ingot,
'r', Items.redstone,
't', WarpDrive.itemComponent.getItemStack(1),
'l', WarpDrive.itemComponent.getItemStack(3),
'p', WarpDrive.itemComponent.getItemStack(6)));
// Transporter
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockTransporter), false, "iii", "ptc", "iii",
'i', Items.iron_ingot,
't', WarpDrive.itemComponent.getItemStack(1),
'c', WarpDrive.itemComponent.getItemStack(5),
'p', WarpDrive.itemComponent.getItemStack(6)));
// Particle Booster
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaserMedium), false, "ipi", "rgr", "iii",
'i', Items.iron_ingot,
'r', Items.redstone,
'g', Blocks.glass,
'p', WarpDrive.itemComponent.getItemStack(6)));
// Camera
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCamera), false, "ngn", "i i", "ici",
'i', Items.iron_ingot,
'n', Items.gold_nugget,
'g', Blocks.glass,
'c', WarpDrive.itemComponent.getItemStack(5)));
// LaserCamera
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(WarpDrive.blockLaserCamera), WarpDrive.blockCamera, WarpDrive.blockLaser));
// Monitor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockMonitor), false, "ggg", "iti", "ici",
'i', Items.iron_ingot,
't', Blocks.torch,
'g', Blocks.glass,
'c', WarpDrive.itemComponent.getItemStack(5)));
// Cloaking device
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCloakingCore), false, "ipi", "lrl", "ici",
'i', Items.iron_ingot,
'r', Items.redstone,
'l', WarpDrive.itemComponent.getItemStack(3),
'c', WarpDrive.itemComponent.getItemStack(5),
'p', WarpDrive.itemComponent.getItemStack(6)));
// Cloaking coil
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCloakingCoil), false, "ini", "rdr", "ini",
'i', Items.iron_ingot,
'd', Items.diamond,
'r', Items.redstone,
'n', Items.gold_nugget));
// Power Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockEnanReactorLaser), false, "iii", "ilg", "ici",
'i', Items.iron_ingot,
'g', Blocks.glass,
'c', WarpDrive.itemComponent.getItemStack(5),
'l', WarpDrive.itemComponent.getItemStack(3)));
// Power Reactor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockEnanReactorCore), false, "ipi", "gog", "ici",
'i', Items.iron_ingot,
'g', Blocks.glass,
'o', WarpDrive.itemComponent.getItemStack(4),
'c', WarpDrive.itemComponent.getItemStack(5),
'p', WarpDrive.itemComponent.getItemStack(6)));
// Power Store
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockEnergyBank), false, "ipi", "isi", "ici",
'i', Items.iron_ingot,
's', WarpDrive.itemComponent.getItemStack(7),
'c', WarpDrive.itemComponent.getItemStack(5),
'p', WarpDrive.itemComponent.getItemStack(6)));
// Transport Beacon
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockTransportBeacon), false, " e ", "ldl", " s ",
'e', Items.ender_pearl,
'l', "dyeBlue",
'd', Items.diamond,
's', Items.stick));
// Chunk Loader
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockChunkLoader), false, "ipi", "ici", "ifi",
'i', Items.iron_ingot,
'p', WarpDrive.itemComponent .getItemStack(6),
'c', WarpDrive.itemComponent.getItemStack(0),
'f', WarpDrive.itemComponent.getItemStack(5)));
// Helmet
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.itemHelmet), false, "iii", "iwi", "gcg",
'i', Items.iron_ingot,
'w', Blocks.wool,
'g', Blocks.glass,
'c', WarpDrive.itemComponent.getItemStack(8)));
}
public static void initIC2() {
ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1).copy();
ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1).copy();
ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12).copy();
ItemStack miner = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 7).copy();
ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9).copy();
ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9).copy();
ItemStack circuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuit", -1).copy();
ItemStack advancedCircuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuitAdv", -1).copy();
ItemStack ironPlate = WarpDriveConfig.getModItemStack("IC2", "itemPlates", 4).copy();
ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1).copy();
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockShipCore), "ici", "cmc", "ici",
'i', iridiumAlloy,
'm', advancedMachine,
'c', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockShipController), "iic", "imi", "cii",
'i', iridiumAlloy,
'm', advancedMachine,
'c', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockRadar), "ifi", "imi", "imi",
'i', iridiumAlloy,
'm', advancedMachine,
'f', WarpDriveConfig.getModItemStack("IC2", "itemFreq", -1));
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockWarpIsolation), "iii", "idi", "iii",
'i', WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1),
'm', advancedMachine,
'd', Blocks.diamond_block);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockAirGenerator), "lcl", "lml", "lll",
'l', Blocks.leaves,
'm', advancedMachine,
'c', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockLaser), "sss", "ama", "aaa",
'm', advancedMachine,
'a', advancedAlloy,
's', advancedCircuit);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockMiningLaser), "aaa", "ama", "ccc",
'c', advancedCircuit,
'a', advancedAlloy,
'm', miner);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockLaserMedium), "afc", "ama", "cfa",
'c', advancedCircuit,
'a', advancedAlloy,
'f', fiberGlassCable,
'm', mfe);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockLift), "aca", "ama", "a#a",
'c', advancedCircuit,
'a', WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1),
'm', magnetizer);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockIridium), "iii", "iii", "iii",
'i', iridiumAlloy);
GameRegistry.addShapelessRecipe(new ItemStack(iridiumAlloy.getItem(), 9), new ItemStack(WarpDrive.blockIridium));
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockLaserCamera), "imi", "cec", "#k#",
'i', iridiumAlloy,
'm', advancedMachine,
'c', advancedCircuit,
'e', WarpDrive.blockLaser,
'k', WarpDrive.blockCamera);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockCamera), "cgc", "gmg", "cgc",
'm', advancedMachine,
'c', advancedCircuit,
'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockMonitor), "gcg", "gmg", "ggg",
'm', advancedMachine,
'c', advancedCircuit,
'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockShipScanner), "sgs", "mma", "amm",
'm', advancedMachine,
'a', advancedAlloy,
's', advancedCircuit,
'g', Blocks.glass);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaserTreeFarm), false, new Object[] { "cwc", "wmw", "cwc",
'c', circuit,
'w', "logWood",
'm', WarpDrive.blockMiningLaser }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockTransporter), false, new Object[] { "ece", "imi", "iei",
'e', Items.ender_pearl,
'c', circuit,
'i', ironPlate,
'm', advancedMachine }));
if (WarpDriveConfig.isIndustrialCraft2loaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.itemIC2reactorLaserFocus), false, new Object[] { " p ", "pdp", " p ",
'p', ironPlate,
'd', "gemDiamond" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockIC2reactorLaserMonitor), false, new Object[] { "pdp", "dmd", "pdp",
'p', ironPlate,
'd', "gemDiamond",
'm', mfe }));
}
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockCloakingCore), "imi", "mcm", "imi",
'i', WarpDrive.blockIridium,
'c', WarpDrive.blockCloakingCoil,
'm', advancedMachine);
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockCloakingCoil), "iai", "aca", "iai",
'i', iridiumAlloy,
'c', advancedCircuit,
'a', advancedAlloy);
}
public static void initHardIC2() {
ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1).copy();
ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1).copy();
ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12).copy();
ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9).copy();
ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9).copy();
ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1).copy();
ItemStack mfsu = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 2).copy();
ItemStack energiumDust = WarpDriveConfig.getModItemStack("IC2", "itemDust2", 2).copy();
ItemStack crystalmemory = WarpDriveConfig.getModItemStack("IC2", "itemcrystalmemory", -1).copy();
ItemStack itemHAMachine = new ItemStack(WarpDrive.blockHighlyAdvancedMachine).copy();
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockShipCore),"uau", "tmt", "uau",
'a', advancedAlloy,
't', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 0), // Teleporter
'm', itemHAMachine,
'u', mfsu);
if (WarpDriveConfig.isOpenComputersLoaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipController), false, new Object[] { "aha", "cmc", "apa", // With OC Adapter
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'h', crystalmemory,
'p', WarpDriveConfig.getModItemStack("OpenComputers", "adapter", -1)}));
} else if (WarpDriveConfig.isComputerCraftLoaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipController), false, new Object[] { "aha", "cmc", "apa", // With CC Modem
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'h', crystalmemory,
'p', WarpDriveConfig.getModItemStack("ComputerCraft", "CC-Cable", 1)}));
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipController), false, new Object[] { "aha", "cmc", "aca",
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'h', crystalmemory}));
}
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockRadar), false, new Object[] { "afa", "cmc", "aca",
'a', advancedAlloy,
'm', itemHAMachine,
'c', "circuitAdvanced",
'f', WarpDriveConfig.getModItemStack("IC2", "itemFreq", -1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockWarpIsolation), false, new Object[] { "sls", "lml", "sls",
's', "plateDenseSteel",
'l', "plateDenseLead",
'm', itemHAMachine}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockAirGenerator), false, new Object[] { "lel", "vmv", "lcl",
'l', Blocks.leaves,
'm', WarpDriveConfig.getModItemStack("IC2", "blockMachine", 0),
'c', "circuitBasic",
'e', WarpDriveConfig.getModItemStack("IC2", "blockMachine", 5), // Compressor
'v', WarpDriveConfig.getModItemStack("IC2", "reactorVent", -1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaser), false, new Object[] { "aca", "cmc", "ala",
'm', advancedMachine,
'a', advancedAlloy,
'c', "circuitAdvanced",
'l', WarpDriveConfig.getModItemStack("IC2", "itemToolMiningLaser", -1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockMiningLaser), false, new Object[] { "pcp", "pap", "plp",
'c', "circuitAdvanced",
'p', advancedAlloy,
'a', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 11), // Advanced Miner
'l', WarpDrive.blockLaser}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaserMedium), false, new Object[] { "efe", "aca", "ama",
'c', "circuitAdvanced",
'a', advancedAlloy,
'f', fiberGlassCable,
'e', energiumDust,
'm', mfe}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLift), false, new Object[] { "aca", "ama", "aea",
'c', "circuitAdvanced",
'a', advancedAlloy,
'm', magnetizer,
'e', energiumDust}));
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockIridium), "iii", "iii", "iii",
'i', iridiumAlloy);
GameRegistry.addShapelessRecipe(new ItemStack(iridiumAlloy.getItem(), 9), new ItemStack(WarpDrive.blockIridium));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaserCamera), false, new Object[] { "ala", "sss", "aca",
'a', advancedAlloy,
's', "circuitAdvanced",
'l', WarpDrive.blockLaser,
'c', WarpDrive.blockCamera}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCamera), false, new Object[] { "aed", "cma", "aga",
'a', advancedAlloy,
'e', WarpDriveConfig.getModItemStack("IC2", "itemRecipePart", 1), // Electric Motor
'd', "gemDiamond",
'c', crystalmemory,
'm', advancedMachine,
'g', WarpDriveConfig.getModItemStack("IC2", "itemCable", 2)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockMonitor), false, new Object[] { "ala", "aca", "aga",
'a', advancedAlloy,
'l', Blocks.redstone_lamp,
'c', "circuitAdvanced",
'g', "paneGlassColorless" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipScanner), false, new Object[] { "ici", "isi", "mcm",
'm', mfsu,
'i', iridiumAlloy,
'c', "circuitAdvanced",
's', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 7) })); // Scanner
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockLaserTreeFarm), false, new Object[] { "awa", "cmc", "asa",
'a', advancedAlloy,
'c', "circuitAdvanced",
'w', "logWood",
'm', WarpDrive.blockMiningLaser,
's', WarpDriveConfig.getModItemStack("IC2", "itemToolChainsaw", -1) }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockTransporter), false, new Object[] { "aea", "ctc", "ama",
'a', advancedAlloy,
'e', Items.ender_pearl,
'c', "circuitAdvanced",
'm', advancedMachine,
't', WarpDriveConfig.getModItemStack("IC2", "blockMachine2", 0) })); // Teleporter
// IC2 is loaded for this recipe set
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.itemIC2reactorLaserFocus), false, new Object[] { "a a", " d ", "a a",
'a', advancedAlloy,
'd', "gemDiamond" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockIC2reactorLaserMonitor), false, new Object[] { "pdp", "dmd", "pdp",
'p', advancedAlloy,
'd', "gemDiamond",
'm', mfe }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCloakingCore), false, new Object[] { "ici", "cmc", "igi",
'i', WarpDrive.blockIridium,
'c', WarpDrive.blockCloakingCoil,
'm', WarpDrive.blockHighlyAdvancedMachine,
'g', "circuitAdvanced" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCloakingCoil), false, new Object[] { "iai", "ccc", "iai",
'i', iridiumAlloy,
'c', WarpDriveConfig.getModItemStack("IC2", "itemRecipePart", 0), // Coil
'a', advancedAlloy }));
GameRegistry.addRecipe(new ItemStack(WarpDrive.blockHighlyAdvancedMachine), "iii", "imi", "iii",
'i', iridiumAlloy,
'm', advancedMachine);
}
}

View file

@ -103,7 +103,7 @@ public class WarpDriveConfig {
public static boolean RECIPES_ENABLE_VANILLA = false;
public static boolean RECIPES_ENABLE_MIXED = false;
// logging
// Logging
public static boolean LOGGING_JUMP = false;
public static boolean LOGGING_ENERGY = false;
public static boolean LOGGING_EFFECTS = false;
@ -120,10 +120,10 @@ public class WarpDriveConfig {
public static boolean LOGGING_BREATHING = false;
public static boolean LOGGING_WORLDGEN = false;
// Transition planes
// Planets
public static Planet[] PLANETS = null;
// Warp Drive Core
// Ship
public static int SHIP_MAX_ENERGY_STORED = 100000000;
public static int SHIP_NORMALJUMP_ENERGY_PER_BLOCK = 10;
public static int SHIP_NORMALJUMP_ENERGY_PER_DISTANCE = 100;
@ -146,7 +146,7 @@ public class WarpDriveConfig {
public static String[] SHIP_VOLUME_UNLIMITED_PLAYERNAMES = { "notch", "someone" };
public static boolean SHIP_WARMUP_SICKNESS = true;
// Warp Radar
// Radar
public static int RADAR_MAX_ENERGY_STORED = 100000000; // 100kk eU
public static int RADAR_MAX_ISOLATION_RANGE = 2;
public static int RADAR_MIN_ISOLATION_BLOCKS = 5;
@ -161,7 +161,7 @@ public class WarpDriveConfig {
public static int SS_ENERGY_PER_BLOCK_DEPLOY = 5000;
public static int SS_MAX_DEPLOY_RADIUS_BLOCKS = 50;
// Particle Booster
// Laser medium
public static int LASER_MEDIUM_MAX_ENERGY_STORED = 100000;
// Laser Emitter
@ -188,7 +188,7 @@ public class WarpDriveConfig {
public static int LASER_CANNON_BLOCK_HIT_EXPLOSION_ENERGY_PER_STRENGTH = 125000;
public static float LASER_CANNON_BLOCK_HIT_EXPLOSION_MAX_STRENGTH = 100F;
// Mining Laser
// Mining laser
// BuildCraft quarry values for reference
// - harvesting one block is 60 MJ/block = 600 RF/block = ~145 EU/block
// - maximum speed is 3.846 ticks per blocks
@ -246,7 +246,7 @@ public class WarpDriveConfig {
public static double TRANSPORTER_ENERGY_PER_BLOCK = 100.0;
public static double TRANSPORTER_MAX_BOOST_MUL = 4.0;
// Enantiomorphic Power reactor
// Enantiomorphic power reactor
public static int ENAN_REACTOR_MAX_ENERGY_STORED = 100000000;
public static int ENAN_REACTOR_UPDATE_INTERVAL_TICKS = 5;
public static int ENAN_REACTOR_MAX_LASERS_PER_SECOND = 6;
@ -254,12 +254,12 @@ public class WarpDriveConfig {
// Power store
public static int ENERGY_BANK_MAX_ENERGY_STORED = 1000000;
// Laser Lift
// Laser lift
public static int LIFT_MAX_ENERGY_STORED = 2400;
public static int LIFT_ENERGY_PER_ENTITY = 800;
public static int LIFT_UPDATE_INTERVAL_TICKS = 10;
// Chunk Loader
// Chunk loader
public static int CL_MAX_ENERGY = 1000000;
public static int CL_MAX_DISTANCE = 2;
public static int CL_RF_PER_CHUNKTICK = 320;
@ -287,7 +287,7 @@ public class WarpDriveConfig {
return null;
}
public static void preInit(final String stringConfigDirectory) {
public static void onFMLpreInitialization(final String stringConfigDirectory) {
// create mod folder
configDirectory = new File(stringConfigDirectory, WarpDrive.MODID);
configDirectory.mkdir();
@ -641,7 +641,7 @@ public class WarpDriveConfig {
return Math.min(max, Math.max(value, min));
}
public static void load() {
public static void onFMLInitialization() {
commonWorldGenOres = new ArrayList<Block>();
commonWorldGenOres.add(Blocks.iron_ore);
commonWorldGenOres.add(Blocks.gold_ore);

View file

@ -1,4 +1,4 @@
package cr0s.warpdrive;
package cr0s.warpdrive.event;
import java.util.HashMap;
@ -17,6 +17,7 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IBreathingHelmet;
import cr0s.warpdrive.config.WarpDriveConfig;
import cr0s.warpdrive.world.SpaceTeleporter;
@ -25,7 +26,7 @@ import cr0s.warpdrive.world.SpaceTeleporter;
*
* @author Cr0s
*/
public class SpaceEventHandler {
public class LivingHandler {
private HashMap<Integer, Integer> entity_airBlock;
private HashMap<String, Integer> player_airTank;
private HashMap<String, Integer> player_cloakTicks;
@ -35,7 +36,7 @@ public class SpaceEventHandler {
private final int AIR_TANK_TICKS = 300;
private final int AIR_DROWN_TICKS = 20;
public SpaceEventHandler() {
public LivingHandler() {
entity_airBlock = new HashMap<Integer, Integer>();
player_airTank = new HashMap<String, Integer>();
player_cloakTicks = new HashMap<String, Integer>();
@ -228,7 +229,7 @@ public class SpaceEventHandler {
}
@SubscribeEvent
public void livingFall(LivingFallEvent event) {
public void onLivingFall(LivingFallEvent event) {
EntityLivingBase entity = event.entityLiving;
float distance = event.distance;

View file

@ -1,17 +1,22 @@
package cr0s.warpdrive;
package cr0s.warpdrive.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.WarpDrive;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.world.ChunkWatchEvent;
import net.minecraftforge.event.world.WorldEvent;
public class EventListeners {
/**
*
* @author LemADEC
*/
public class WorldHandler {
//TODO: register as event receiver
public void onChunkLoaded(ChunkWatchEvent event) {