2012-05-09 22:43:05 +02:00
/ * *
2017-11-10 19:30:16 +01:00
* Copyright ( c ) 2011 - 2017 , SpaceToad and the BuildCraft Team
2014-01-20 21:15:30 +01:00
* http : //www.mod-buildcraft.com
2015-09-20 11:20:30 +02:00
* < p / >
2014-01-20 21:15:30 +01:00
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1 . 0 , or MMPL . Please check the contents of the license located in
2012-05-09 22:43:05 +02:00
* http : //www.mod-buildcraft.com/MMPL-1.0.txt
* /
2012-07-25 12:45:15 +02:00
package buildcraft ;
2012-05-09 22:43:05 +02:00
2014-05-07 09:16:12 +02:00
import java.io.BufferedReader ;
2014-02-16 12:14:30 +01:00
import java.io.File ;
2014-05-07 09:16:12 +02:00
import java.io.InputStreamReader ;
2014-10-30 12:47:55 +01:00
import java.io.PrintWriter ;
2015-04-16 15:08:33 +02:00
import java.util.List ;
2015-05-07 19:49:53 +02:00
2015-04-16 15:08:33 +02:00
import com.google.common.collect.Lists ;
2015-05-07 19:49:53 +02:00
2015-04-16 15:08:33 +02:00
import net.minecraft.block.Block ;
import net.minecraft.client.renderer.texture.TextureMap ;
2014-03-22 11:56:12 +01:00
import net.minecraft.entity.item.EntityItemFrame ;
2014-03-22 14:47:42 +01:00
import net.minecraft.entity.item.EntityMinecartChest ;
import net.minecraft.entity.item.EntityMinecartEmpty ;
import net.minecraft.entity.item.EntityMinecartFurnace ;
import net.minecraft.entity.item.EntityMinecartHopper ;
import net.minecraft.entity.item.EntityMinecartTNT ;
2014-03-22 14:57:57 +01:00
import net.minecraft.entity.item.EntityPainting ;
2014-02-16 12:14:30 +01:00
import net.minecraft.init.Blocks ;
import net.minecraft.init.Items ;
2014-10-21 02:06:57 +02:00
import net.minecraft.item.Item ;
2014-02-16 12:14:30 +01:00
import net.minecraft.item.ItemStack ;
2014-05-06 18:56:22 +02:00
import net.minecraft.launchwrapper.Launch ;
2015-03-03 21:47:33 +01:00
import net.minecraft.stats.Achievement ;
2015-04-16 15:08:33 +02:00
import net.minecraft.world.World ;
2015-09-20 11:20:30 +02:00
2015-04-02 14:46:57 +02:00
import cpw.mods.fml.client.event.ConfigChangedEvent ;
import cpw.mods.fml.common.FMLCommonHandler ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.Mod ;
2014-10-21 02:14:54 +02:00
import cpw.mods.fml.common.event.FMLInitializationEvent ;
import cpw.mods.fml.common.event.FMLInterModComms ;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent ;
2014-10-26 11:43:54 +01:00
import cpw.mods.fml.common.event.FMLPostInitializationEvent ;
2014-10-21 02:14:54 +02:00
import cpw.mods.fml.common.event.FMLPreInitializationEvent ;
2015-09-20 11:20:30 +02:00
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent ;
2014-10-21 02:14:54 +02:00
import cpw.mods.fml.common.event.FMLServerStoppingEvent ;
2014-05-03 18:59:52 +02:00
import cpw.mods.fml.common.eventhandler.SubscribeEvent ;
import cpw.mods.fml.common.network.NetworkRegistry ;
import cpw.mods.fml.common.registry.GameRegistry ;
import cpw.mods.fml.relauncher.Side ;
import cpw.mods.fml.relauncher.SideOnly ;
2014-02-16 12:14:30 +01:00
import net.minecraftforge.client.event.TextureStitchEvent ;
2015-09-20 11:20:30 +02:00
import net.minecraftforge.common.DimensionManager ;
2015-04-16 15:08:33 +02:00
import net.minecraftforge.common.ForgeChunkManager ;
2014-02-16 12:14:30 +01:00
import net.minecraftforge.common.MinecraftForge ;
2014-10-30 12:47:55 +01:00
import net.minecraftforge.common.config.Property ;
2015-05-07 19:49:53 +02:00
2014-05-02 20:16:20 +02:00
import buildcraft.api.blueprints.BlueprintDeployer ;
2014-10-26 12:27:51 +01:00
import buildcraft.api.blueprints.BuilderAPI ;
import buildcraft.api.blueprints.ISchematicRegistry ;
2014-04-13 19:22:41 +02:00
import buildcraft.api.blueprints.SchematicBlock ;
2014-04-18 08:50:48 +02:00
import buildcraft.api.blueprints.SchematicEntity ;
2014-04-13 19:22:41 +02:00
import buildcraft.api.blueprints.SchematicFactory ;
2014-04-18 08:50:48 +02:00
import buildcraft.api.blueprints.SchematicMask ;
2015-10-02 13:05:09 +02:00
import buildcraft.api.blueprints.SchematicTile ;
2014-05-06 18:56:22 +02:00
import buildcraft.api.core.JavaTools ;
2015-03-13 14:27:22 +01:00
import buildcraft.api.library.LibraryAPI ;
2014-10-28 16:36:06 +01:00
import buildcraft.api.statements.StatementManager ;
2012-07-25 12:45:15 +02:00
import buildcraft.builders.BlockArchitect ;
import buildcraft.builders.BlockBlueprintLibrary ;
import buildcraft.builders.BlockBuilder ;
2014-07-06 16:59:37 +02:00
import buildcraft.builders.BlockConstructionMarker ;
2012-07-25 12:45:15 +02:00
import buildcraft.builders.BlockFiller ;
2015-04-16 15:08:33 +02:00
import buildcraft.builders.BlockFrame ;
import buildcraft.builders.BlockQuarry ;
2015-03-13 14:27:22 +01:00
import buildcraft.builders.BlueprintServerDatabase ;
2014-02-21 21:30:12 +01:00
import buildcraft.builders.BuilderProxy ;
2015-04-16 15:08:33 +02:00
import buildcraft.builders.BuilderProxyClient ;
2015-10-06 16:12:16 +02:00
import buildcraft.builders.BuilderTooltipHandler ;
2015-03-04 22:44:44 +01:00
import buildcraft.builders.BuildersGuiHandler ;
2014-10-26 11:43:54 +01:00
import buildcraft.builders.HeuristicBlockDetection ;
2013-11-15 06:25:35 +01:00
import buildcraft.builders.ItemBlueprintStandard ;
import buildcraft.builders.ItemBlueprintTemplate ;
2014-09-04 08:49:23 +02:00
import buildcraft.builders.ItemConstructionMarker ;
2015-03-13 14:27:22 +01:00
import buildcraft.builders.LibraryBlueprintTypeHandler ;
import buildcraft.builders.LibraryBookTypeHandler ;
2015-03-31 23:21:00 +02:00
import buildcraft.builders.LibraryDatabase ;
2012-07-25 12:45:15 +02:00
import buildcraft.builders.TileArchitect ;
import buildcraft.builders.TileBlueprintLibrary ;
import buildcraft.builders.TileBuilder ;
2014-07-06 16:59:37 +02:00
import buildcraft.builders.TileConstructionMarker ;
2012-07-25 12:45:15 +02:00
import buildcraft.builders.TileFiller ;
2015-04-16 15:08:33 +02:00
import buildcraft.builders.TileQuarry ;
2015-03-31 23:21:00 +02:00
import buildcraft.builders.blueprints.RealBlueprintDeployer ;
2015-09-20 11:20:30 +02:00
import buildcraft.builders.schematics.SchematicAir ;
import buildcraft.builders.schematics.SchematicBed ;
2015-10-02 13:05:09 +02:00
import buildcraft.builders.schematics.SchematicBrewingStand ;
import buildcraft.builders.schematics.SchematicBuilderLike ;
2015-09-20 11:20:30 +02:00
import buildcraft.builders.schematics.SchematicCactus ;
import buildcraft.builders.schematics.SchematicCustomStack ;
import buildcraft.builders.schematics.SchematicDirt ;
import buildcraft.builders.schematics.SchematicDoor ;
import buildcraft.builders.schematics.SchematicEnderChest ;
import buildcraft.builders.schematics.SchematicFactoryBlock ;
import buildcraft.builders.schematics.SchematicFactoryEntity ;
import buildcraft.builders.schematics.SchematicFactoryMask ;
import buildcraft.builders.schematics.SchematicFarmland ;
import buildcraft.builders.schematics.SchematicFire ;
import buildcraft.builders.schematics.SchematicGlassPane ;
import buildcraft.builders.schematics.SchematicGravel ;
import buildcraft.builders.schematics.SchematicHanging ;
2015-10-02 13:05:09 +02:00
import buildcraft.builders.schematics.SchematicJukebox ;
2015-10-06 18:55:38 +02:00
import buildcraft.builders.schematics.SchematicMetadataMask ;
2015-09-20 11:20:30 +02:00
import buildcraft.builders.schematics.SchematicMinecart ;
import buildcraft.builders.schematics.SchematicPiston ;
import buildcraft.builders.schematics.SchematicPortal ;
import buildcraft.builders.schematics.SchematicPumpkin ;
import buildcraft.builders.schematics.SchematicRail ;
import buildcraft.builders.schematics.SchematicRedstoneDiode ;
import buildcraft.builders.schematics.SchematicRedstoneLamp ;
import buildcraft.builders.schematics.SchematicRedstoneWire ;
import buildcraft.builders.schematics.SchematicSeeds ;
import buildcraft.builders.schematics.SchematicSign ;
2015-09-20 14:04:46 +02:00
import buildcraft.builders.schematics.SchematicSilverfish ;
2015-09-20 11:20:30 +02:00
import buildcraft.builders.schematics.SchematicSkull ;
import buildcraft.builders.schematics.SchematicStone ;
import buildcraft.builders.schematics.SchematicTripWireHook ;
2015-11-20 17:08:47 +01:00
import buildcraft.builders.schematics.SchematicTripwire ;
2014-10-26 13:20:08 +01:00
import buildcraft.builders.statements.BuildersActionProvider ;
2015-09-29 09:54:12 +02:00
import buildcraft.core.BCRegistry ;
2015-03-04 15:49:21 +01:00
import buildcraft.core.CompatHooks ;
2012-07-25 12:45:15 +02:00
import buildcraft.core.DefaultProps ;
2013-09-12 15:27:11 +02:00
import buildcraft.core.InterModComms ;
2015-07-16 08:58:07 +02:00
import buildcraft.core.TileMarker ;
import buildcraft.core.TilePathMarker ;
2012-09-08 21:46:17 +02:00
import buildcraft.core.Version ;
2014-10-26 12:27:51 +01:00
import buildcraft.core.blueprints.SchematicRegistry ;
2015-04-01 08:13:06 +02:00
import buildcraft.core.builders.schematics.SchematicBlockCreative ;
2015-04-18 10:23:41 +02:00
import buildcraft.core.builders.schematics.SchematicFree ;
2015-04-01 08:13:06 +02:00
import buildcraft.core.builders.schematics.SchematicIgnore ;
import buildcraft.core.builders.schematics.SchematicRotateMeta ;
2015-09-12 17:43:23 +02:00
import buildcraft.core.builders.schematics.SchematicRotateMetaSupported ;
2015-04-01 08:13:06 +02:00
import buildcraft.core.builders.schematics.SchematicTileCreative ;
2015-04-02 14:46:57 +02:00
import buildcraft.core.config.ConfigManager ;
2014-01-12 17:57:32 +01:00
2012-12-17 23:30:54 +01:00
@Mod ( name = " BuildCraft Builders " , version = Version . VERSION , useMetadata = false , modid = " BuildCraft|Builders " , dependencies = DefaultProps . DEPENDENCY_CORE )
2014-01-13 20:26:16 +01:00
public class BuildCraftBuilders extends BuildCraftMod {
2012-06-08 02:13:31 +02:00
2014-07-28 23:51:50 +02:00
@Mod.Instance ( " BuildCraft|Builders " )
public static BuildCraftBuilders instance ;
2014-07-06 16:59:37 +02:00
public static BlockConstructionMarker constructionMarkerBlock ;
2012-05-09 22:43:05 +02:00
public static BlockFiller fillerBlock ;
public static BlockBuilder builderBlock ;
public static BlockArchitect architectBlock ;
public static BlockBlueprintLibrary libraryBlock ;
2015-04-16 15:08:33 +02:00
public static BlockQuarry quarryBlock ;
public static BlockFrame frameBlock ;
2013-11-15 06:25:35 +01:00
public static ItemBlueprintTemplate templateItem ;
public static ItemBlueprintStandard blueprintItem ;
2014-07-27 23:05:35 +02:00
2015-03-03 21:47:33 +01:00
public static Achievement architectAchievement ;
public static Achievement libraryAchievement ;
public static Achievement blueprintAchievement ;
public static Achievement builderAchievement ;
public static Achievement templateAchievement ;
2015-04-16 15:08:33 +02:00
public static Achievement chunkDestroyerAchievement ;
2012-05-09 22:43:05 +02:00
2015-03-13 14:27:22 +01:00
public static BlueprintServerDatabase serverDB ;
public static LibraryDatabase clientDB ;
2014-01-12 17:57:32 +01:00
2014-10-30 12:47:55 +01:00
public static boolean debugPrintSchematicList = false ;
2015-02-26 19:07:29 +01:00
public static boolean dropBrokenBlocks = false ;
2015-03-13 14:27:22 +01:00
2015-04-16 15:08:33 +02:00
public static boolean quarryLoadsChunks = true ;
public static boolean quarryOneTimeUse = false ;
2015-09-20 09:43:49 +02:00
private String oldBlueprintServerDir , blueprintClientDir ;
2015-03-13 14:27:22 +01:00
2015-04-16 15:08:33 +02:00
public class QuarryChunkloadCallback implements ForgeChunkManager . OrderedLoadingCallback {
@Override
public void ticketsLoaded ( List < ForgeChunkManager . Ticket > tickets , World world ) {
for ( ForgeChunkManager . Ticket ticket : tickets ) {
int quarryX = ticket . getModData ( ) . getInteger ( " quarryX " ) ;
int quarryY = ticket . getModData ( ) . getInteger ( " quarryY " ) ;
int quarryZ = ticket . getModData ( ) . getInteger ( " quarryZ " ) ;
Block block = world . getBlock ( quarryX , quarryY , quarryZ ) ;
if ( block = = quarryBlock ) {
TileQuarry tq = ( TileQuarry ) world . getTileEntity ( quarryX , quarryY , quarryZ ) ;
tq . forceChunkLoading ( ticket ) ;
}
}
}
@Override
public List < ForgeChunkManager . Ticket > ticketsLoaded ( List < ForgeChunkManager . Ticket > tickets , World world , int maxTicketCount ) {
List < ForgeChunkManager . Ticket > validTickets = Lists . newArrayList ( ) ;
for ( ForgeChunkManager . Ticket ticket : tickets ) {
int quarryX = ticket . getModData ( ) . getInteger ( " quarryX " ) ;
int quarryY = ticket . getModData ( ) . getInteger ( " quarryY " ) ;
int quarryZ = ticket . getModData ( ) . getInteger ( " quarryZ " ) ;
Block block = world . getBlock ( quarryX , quarryY , quarryZ ) ;
if ( block = = quarryBlock ) {
validTickets . add ( ticket ) ;
}
}
return validTickets ;
}
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2014-01-12 17:57:32 +01:00
public void loadConfiguration ( FMLPreInitializationEvent evt ) {
2015-04-02 14:46:57 +02:00
BuildCraftCore . mainConfigManager . register ( " blueprints.serverDatabaseDirectory " ,
2014-05-06 18:56:22 +02:00
" \" $MINECRAFT " + File . separator + " config " + File . separator + " buildcraft " + File . separator
2015-04-02 14:46:57 +02:00
+ " blueprints " + File . separator + " server \" " ,
2015-09-20 09:43:49 +02:00
" DEPRECATED - USED ONLY FOR COMPATIBILITY " , ConfigManager . RestartRequirement . GAME ) ;
2015-04-02 14:46:57 +02:00
BuildCraftCore . mainConfigManager . register ( " blueprints.clientDatabaseDirectory " ,
" \" $MINECRAFT " + File . separator + " blueprints \" " ,
" Location for the client blueprint database (used by the Electronic Library). " , ConfigManager . RestartRequirement . NONE ) ;
2014-05-06 18:56:22 +02:00
2015-04-02 14:46:57 +02:00
BuildCraftCore . mainConfigManager . register ( " general.markerRange " , 64 , " Set the maximum marker range. " , ConfigManager . RestartRequirement . NONE ) ;
2015-04-18 14:28:32 +02:00
BuildCraftCore . mainConfigManager . register ( " general.quarry.oneTimeUse " , false , " Should the quarry only be usable once after placing? " , ConfigManager . RestartRequirement . NONE ) ;
2015-05-17 21:48:00 +02:00
BuildCraftCore . mainConfigManager . register ( " general.quarry.doChunkLoading " , true , " Should the quarry keep the chunks it is working on loaded? " , ConfigManager . RestartRequirement . NONE ) ;
2014-05-06 18:56:22 +02:00
2015-05-29 06:08:56 +02:00
BuildCraftCore . mainConfigManager . register ( " builders.dropBrokenBlocks " , false , " Should the builder and filler drop the cleared blocks? " , ConfigManager . RestartRequirement . NONE ) ;
2015-04-02 14:46:57 +02:00
BuildCraftCore . mainConfigManager . get ( " blueprints.serverDatabaseDirectory " ) . setShowInGui ( false ) ;
BuildCraftCore . mainConfigManager . get ( " general.markerRange " ) . setMinValue ( 8 ) . setMaxValue ( 64 ) ;
serverDB = new BlueprintServerDatabase ( ) ;
clientDB = new LibraryDatabase ( ) ;
reloadConfig ( ConfigManager . RestartRequirement . GAME ) ;
2015-02-26 19:07:29 +01:00
2015-04-02 14:46:57 +02:00
Property printSchematicList = BuildCraftCore . mainConfiguration . get ( " debug " , " printBlueprintSchematicList " , false ) ;
2014-10-30 12:47:55 +01:00
debugPrintSchematicList = printSchematicList . getBoolean ( ) ;
2015-04-02 14:46:57 +02:00
}
2014-05-06 18:56:22 +02:00
2015-04-02 14:46:57 +02:00
public void reloadConfig ( ConfigManager . RestartRequirement restartType ) {
if ( restartType = = ConfigManager . RestartRequirement . GAME ) {
reloadConfig ( ConfigManager . RestartRequirement . WORLD ) ;
} else if ( restartType = = ConfigManager . RestartRequirement . WORLD ) {
2015-09-20 09:43:49 +02:00
oldBlueprintServerDir = BuildCraftCore . mainConfigManager . get ( " blueprints.serverDatabaseDirectory " ) . getString ( ) ;
oldBlueprintServerDir = JavaTools . stripSurroundingQuotes ( replacePathVariables ( oldBlueprintServerDir ) ) ;
2015-04-02 14:46:57 +02:00
reloadConfig ( ConfigManager . RestartRequirement . NONE ) ;
} else {
2015-04-16 15:08:33 +02:00
quarryOneTimeUse = BuildCraftCore . mainConfigManager . get ( " general.quarry.oneTimeUse " ) . getBoolean ( ) ;
quarryLoadsChunks = BuildCraftCore . mainConfigManager . get ( " general.quarry.doChunkLoading " ) . getBoolean ( ) ;
2015-04-02 14:46:57 +02:00
blueprintClientDir = BuildCraftCore . mainConfigManager . get ( " blueprints.clientDatabaseDirectory " ) . getString ( ) ;
blueprintClientDir = JavaTools . stripSurroundingQuotes ( replacePathVariables ( blueprintClientDir ) ) ;
2015-09-20 11:20:30 +02:00
clientDB . init ( new String [ ] {
2015-04-02 14:46:57 +02:00
blueprintClientDir ,
getDownloadsDir ( )
} , blueprintClientDir ) ;
DefaultProps . MARKER_RANGE = BuildCraftCore . mainConfigManager . get ( " general.markerRange " ) . getInt ( ) ;
2015-05-29 06:08:56 +02:00
dropBrokenBlocks = BuildCraftCore . mainConfigManager . get ( " builders.dropBrokenBlocks " ) . getBoolean ( ) ;
2015-04-02 14:46:57 +02:00
if ( BuildCraftCore . mainConfiguration . hasChanged ( ) ) {
BuildCraftCore . mainConfiguration . save ( ) ;
}
}
}
@SubscribeEvent
public void onConfigChanged ( ConfigChangedEvent . PostConfigChangedEvent event ) {
if ( " BuildCraft|Core " . equals ( event . modID ) ) {
reloadConfig ( event . isWorldRunning ? ConfigManager . RestartRequirement . NONE : ConfigManager . RestartRequirement . WORLD ) ;
2014-05-06 18:56:22 +02:00
}
}
2014-05-07 09:16:12 +02:00
private static String getDownloadsDir ( ) {
final String os = System . getProperty ( " os.name " ) . toLowerCase ( ) ;
2014-05-07 11:26:28 +02:00
2014-05-07 09:16:12 +02:00
if ( os . contains ( " nix " ) | | os . contains ( " lin " ) | | os . contains ( " mac " ) ) {
// Linux, Mac or other UNIX
// According XDG specification every user-specified folder can be localized
// or even moved to any destination, so we obtain real path with xdg-user-dir
try {
2015-09-20 11:20:30 +02:00
Process process = Runtime . getRuntime ( ) . exec ( new String [ ] { " xdg-user-dir " , " DOWNLOAD " } ) ;
2014-05-07 09:16:12 +02:00
BufferedReader reader = new BufferedReader ( new InputStreamReader ( process . getInputStream ( ) , " utf-8 " ) ) ;
process . waitFor ( ) ;
String line = reader . readLine ( ) . trim ( ) ;
reader . close ( ) ;
2014-05-07 11:26:28 +02:00
2014-05-07 09:16:12 +02:00
if ( line . length ( ) > 0 ) {
2014-05-07 11:26:28 +02:00
return line ;
2014-05-07 09:16:12 +02:00
}
} catch ( Exception ignored ) {
// Very bad, we have a error while obtaining xdg dir :(
// Just ignore, uses default dir
}
}
// Windows or unknown system
2014-05-07 11:26:28 +02:00
return " $HOME " + File . separator + " Downloads " ;
2014-05-07 09:16:12 +02:00
}
2014-05-06 18:56:22 +02:00
private String replacePathVariables ( String path ) {
2014-05-07 09:16:12 +02:00
String result = path . replace ( " $DOWNLOADS " , getDownloadsDir ( ) ) ;
result = result . replace ( " $HOME " , System . getProperty ( " user.home " ) ) ;
2014-05-06 18:56:22 +02:00
if ( Launch . minecraftHome = = null ) {
2014-05-07 09:16:12 +02:00
result = result . replace ( " $MINECRAFT " , new File ( " . " ) . getAbsolutePath ( ) ) ;
2014-05-06 18:56:22 +02:00
} else {
2014-05-07 09:16:12 +02:00
result = result . replace ( " $MINECRAFT " , Launch . minecraftHome . getAbsolutePath ( ) ) ;
2014-05-06 18:56:22 +02:00
}
2014-10-29 06:33:00 +01:00
if ( " / " . equals ( File . separator ) ) {
2014-10-29 09:25:28 +01:00
result = result . replaceAll ( " \\ \\ " , " / " ) ;
2014-10-29 06:33:00 +01:00
} else {
2014-10-29 09:25:28 +01:00
result = result . replaceAll ( " / " , " \\ \\ " ) ;
2014-10-29 06:33:00 +01:00
}
2015-09-20 11:20:30 +02:00
2014-05-06 18:56:22 +02:00
return result ;
2014-01-12 17:57:32 +01:00
}
2015-09-20 11:20:30 +02:00
2014-10-26 11:43:54 +01:00
@Mod.EventHandler
public void postInit ( FMLPostInitializationEvent evt ) {
HeuristicBlockDetection . start ( ) ;
2015-04-16 15:08:33 +02:00
ForgeChunkManager . setForcedChunkLoadingCallback ( instance , new QuarryChunkloadCallback ( ) ) ;
2015-03-13 14:27:22 +01:00
2014-10-30 12:47:55 +01:00
if ( debugPrintSchematicList ) {
try {
PrintWriter writer = new PrintWriter ( " SchematicDebug.txt " , " UTF-8 " ) ;
writer . println ( " *** REGISTERED SCHEMATICS *** " ) ;
2014-11-01 09:42:53 +01:00
SchematicRegistry reg = ( SchematicRegistry ) BuilderAPI . schematicRegistry ;
2014-11-01 22:25:29 +01:00
for ( String s : reg . schematicBlocks . keySet ( ) ) {
writer . println ( s + " -> " + reg . schematicBlocks . get ( s ) . clazz . getCanonicalName ( ) ) ;
2014-10-30 12:47:55 +01:00
}
writer . close ( ) ;
2014-11-01 09:42:53 +01:00
} catch ( Exception e ) {
2014-10-30 12:47:55 +01:00
e . printStackTrace ( ) ;
}
}
2015-04-17 00:27:26 +02:00
2015-09-20 09:43:49 +02:00
// Refresh the client database once all the library type handlers are registered
2015-09-20 11:20:30 +02:00
// The server database is refreshed later
2015-04-17 00:27:26 +02:00
clientDB . refresh ( ) ;
2014-10-26 11:43:54 +01:00
}
2014-01-12 17:57:32 +01:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-11-19 12:54:37 +01:00
public void init ( FMLInitializationEvent evt ) {
2015-03-04 22:44:44 +01:00
NetworkRegistry . INSTANCE . registerGuiHandler ( instance , new BuildersGuiHandler ( ) ) ;
2012-08-24 19:25:54 +02:00
2015-10-06 16:12:16 +02:00
MinecraftForge . EVENT_BUS . register ( new BuilderTooltipHandler ( ) ) ;
2014-03-22 11:56:12 +01:00
// Standard blocks
2014-10-26 12:27:51 +01:00
ISchematicRegistry schemes = BuilderAPI . schematicRegistry ;
2014-12-12 21:31:51 +01:00
schemes . registerSchematicBlock ( Blocks . air , SchematicAir . class ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . snow , SchematicIgnore . class ) ;
schemes . registerSchematicBlock ( Blocks . tallgrass , SchematicIgnore . class ) ;
schemes . registerSchematicBlock ( Blocks . double_plant , SchematicIgnore . class ) ;
schemes . registerSchematicBlock ( Blocks . ice , SchematicIgnore . class ) ;
schemes . registerSchematicBlock ( Blocks . piston_head , SchematicIgnore . class ) ;
schemes . registerSchematicBlock ( Blocks . dirt , SchematicDirt . class ) ;
schemes . registerSchematicBlock ( Blocks . grass , SchematicDirt . class ) ;
schemes . registerSchematicBlock ( Blocks . cactus , SchematicCactus . class ) ;
schemes . registerSchematicBlock ( Blocks . farmland , SchematicFarmland . class ) ;
schemes . registerSchematicBlock ( Blocks . wheat , SchematicSeeds . class , Items . wheat_seeds ) ;
schemes . registerSchematicBlock ( Blocks . pumpkin_stem , SchematicSeeds . class , Items . pumpkin_seeds ) ;
schemes . registerSchematicBlock ( Blocks . melon_stem , SchematicSeeds . class , Items . melon_seeds ) ;
schemes . registerSchematicBlock ( Blocks . nether_wart , SchematicSeeds . class , Items . nether_wart ) ;
2012-05-09 22:43:05 +02:00
2015-10-02 13:05:09 +02:00
schemes . registerSchematicBlock ( Blocks . flower_pot , SchematicTile . class ) ;
2015-11-20 17:08:47 +01:00
schemes . registerSchematicBlock ( Blocks . tripwire , SchematicTripwire . class ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . tripwire_hook , SchematicTripWireHook . class ) ;
schemes . registerSchematicBlock ( Blocks . skull , SchematicSkull . class ) ;
2015-09-12 17:43:23 +02:00
schemes . registerSchematicBlock ( Blocks . ladder , SchematicRotateMetaSupported . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . fence_gate , SchematicRotateMeta . class , new int [ ] { 0 , 1 , 2 , 3 } , true ) ;
schemes . registerSchematicBlock ( Blocks . log , SchematicRotateMeta . class , new int [ ] { 8 , 4 , 8 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . log2 , SchematicRotateMeta . class , new int [ ] { 8 , 4 , 8 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . hay_block , SchematicRotateMeta . class , new int [ ] { 8 , 4 , 8 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . quartz_block , SchematicRotateMeta . class , new int [ ] { 4 , 3 , 4 , 3 } , true ) ;
schemes . registerSchematicBlock ( Blocks . hopper , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . anvil , SchematicRotateMeta . class , new int [ ] { 0 , 1 , 2 , 3 } , true ) ;
schemes . registerSchematicBlock ( Blocks . furnace , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . lit_furnace , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . chest , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
2015-02-05 03:48:18 +01:00
schemes . registerSchematicBlock ( Blocks . trapped_chest , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . dispenser , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . dropper , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
schemes . registerSchematicBlock ( Blocks . ender_chest , SchematicEnderChest . class ) ;
schemes . registerSchematicBlock ( Blocks . vine , SchematicRotateMeta . class , new int [ ] { 1 , 4 , 8 , 2 } , false ) ;
schemes . registerSchematicBlock ( Blocks . trapdoor , SchematicRotateMeta . class , new int [ ] { 0 , 1 , 2 , 3 } , false ) ;
schemes . registerSchematicBlock ( Blocks . stone , SchematicStone . class ) ;
schemes . registerSchematicBlock ( Blocks . coal_ore , SchematicStone . class ) ;
schemes . registerSchematicBlock ( Blocks . lapis_ore , SchematicStone . class ) ;
schemes . registerSchematicBlock ( Blocks . diamond_ore , SchematicStone . class ) ;
schemes . registerSchematicBlock ( Blocks . redstone_ore , SchematicStone . class ) ;
schemes . registerSchematicBlock ( Blocks . lit_redstone_ore , SchematicStone . class ) ;
schemes . registerSchematicBlock ( Blocks . emerald_ore , SchematicStone . class ) ;
2015-10-06 18:55:38 +02:00
schemes . registerSchematicBlock ( Blocks . leaves , SchematicMetadataMask . class , 3 ) ;
schemes . registerSchematicBlock ( Blocks . leaves2 , SchematicMetadataMask . class , 3 ) ;
schemes . registerSchematicBlock ( Blocks . sapling , SchematicMetadataMask . class , 7 ) ;
2015-10-06 18:37:25 +02:00
2015-09-20 13:06:43 +02:00
schemes . registerSchematicBlock ( Blocks . monster_egg , SchematicSilverfish . class ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . gravel , SchematicGravel . class ) ;
schemes . registerSchematicBlock ( Blocks . redstone_wire , SchematicRedstoneWire . class , new ItemStack ( Items . redstone ) ) ;
schemes . registerSchematicBlock ( Blocks . cake , SchematicCustomStack . class , new ItemStack ( Items . cake ) ) ;
schemes . registerSchematicBlock ( Blocks . glowstone , SchematicCustomStack . class , new ItemStack ( Blocks . glowstone ) ) ;
schemes . registerSchematicBlock ( Blocks . powered_repeater , SchematicRedstoneDiode . class , Items . repeater ) ;
schemes . registerSchematicBlock ( Blocks . unpowered_repeater , SchematicRedstoneDiode . class , Items . repeater ) ;
schemes . registerSchematicBlock ( Blocks . powered_comparator , SchematicRedstoneDiode . class , Items . comparator ) ;
schemes . registerSchematicBlock ( Blocks . unpowered_comparator , SchematicRedstoneDiode . class , Items . comparator ) ;
2015-10-02 13:05:09 +02:00
schemes . registerSchematicBlock ( Blocks . daylight_detector , SchematicTile . class ) ;
schemes . registerSchematicBlock ( Blocks . jukebox , SchematicJukebox . class ) ;
schemes . registerSchematicBlock ( Blocks . noteblock , SchematicTile . class ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . redstone_lamp , SchematicRedstoneLamp . class ) ;
schemes . registerSchematicBlock ( Blocks . lit_redstone_lamp , SchematicRedstoneLamp . class ) ;
schemes . registerSchematicBlock ( Blocks . glass_pane , SchematicGlassPane . class ) ;
schemes . registerSchematicBlock ( Blocks . stained_glass_pane , SchematicGlassPane . class ) ;
schemes . registerSchematicBlock ( Blocks . piston , SchematicPiston . class ) ;
schemes . registerSchematicBlock ( Blocks . piston_extension , SchematicPiston . class ) ;
schemes . registerSchematicBlock ( Blocks . sticky_piston , SchematicPiston . class ) ;
schemes . registerSchematicBlock ( Blocks . lit_pumpkin , SchematicPumpkin . class ) ;
schemes . registerSchematicBlock ( Blocks . wooden_door , SchematicDoor . class , new ItemStack ( Items . wooden_door ) ) ;
schemes . registerSchematicBlock ( Blocks . iron_door , SchematicDoor . class , new ItemStack ( Items . iron_door ) ) ;
schemes . registerSchematicBlock ( Blocks . bed , SchematicBed . class ) ;
schemes . registerSchematicBlock ( Blocks . wall_sign , SchematicSign . class , true ) ;
schemes . registerSchematicBlock ( Blocks . standing_sign , SchematicSign . class , false ) ;
schemes . registerSchematicBlock ( Blocks . portal , SchematicPortal . class ) ;
2012-05-09 22:43:05 +02:00
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . rail , SchematicRail . class ) ;
schemes . registerSchematicBlock ( Blocks . activator_rail , SchematicRail . class ) ;
schemes . registerSchematicBlock ( Blocks . detector_rail , SchematicRail . class ) ;
schemes . registerSchematicBlock ( Blocks . golden_rail , SchematicRail . class ) ;
2015-10-02 13:05:09 +02:00
schemes . registerSchematicBlock ( Blocks . beacon , SchematicTile . class ) ;
schemes . registerSchematicBlock ( Blocks . brewing_stand , SchematicBrewingStand . class ) ;
schemes . registerSchematicBlock ( Blocks . enchanting_table , SchematicTile . class ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . fire , SchematicFire . class ) ;
schemes . registerSchematicBlock ( Blocks . bedrock , SchematicBlockCreative . class ) ;
2015-10-02 13:05:09 +02:00
schemes . registerSchematicBlock ( Blocks . command_block , SchematicTileCreative . class ) ;
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( Blocks . mob_spawner , SchematicTileCreative . class ) ;
2014-05-01 13:14:57 +02:00
2014-03-22 11:56:12 +01:00
// Standard entities
2014-03-18 20:16:15 +01:00
2014-10-26 12:27:51 +01:00
schemes . registerSchematicEntity ( EntityMinecartEmpty . class , SchematicMinecart . class , Items . minecart ) ;
schemes . registerSchematicEntity ( EntityMinecartFurnace . class , SchematicMinecart . class , Items . furnace_minecart ) ;
schemes . registerSchematicEntity ( EntityMinecartTNT . class , SchematicMinecart . class , Items . tnt_minecart ) ;
schemes . registerSchematicEntity ( EntityMinecartChest . class , SchematicMinecart . class , Items . chest_minecart ) ;
schemes . registerSchematicEntity ( EntityMinecartHopper . class , SchematicMinecart . class , Items . hopper_minecart ) ;
2014-04-05 19:03:53 +02:00
2014-10-26 12:27:51 +01:00
schemes . registerSchematicEntity ( EntityPainting . class , SchematicHanging . class , Items . painting ) ;
schemes . registerSchematicEntity ( EntityItemFrame . class , SchematicHanging . class , Items . item_frame ) ;
2014-03-19 11:09:30 +01:00
2014-03-22 11:56:12 +01:00
// BuildCraft blocks
2014-10-26 12:27:51 +01:00
schemes . registerSchematicBlock ( architectBlock , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
2015-10-02 13:05:09 +02:00
schemes . registerSchematicBlock ( builderBlock , SchematicBuilderLike . class ) ;
schemes . registerSchematicBlock ( fillerBlock , SchematicBuilderLike . class ) ;
schemes . registerSchematicBlock ( libraryBlock , SchematicRotateMeta . class , new int [ ] { 2 , 5 , 3 , 4 } , true ) ;
schemes . registerSchematicBlock ( quarryBlock , SchematicBuilderLike . class ) ;
2012-05-09 22:43:05 +02:00
2015-07-16 08:58:07 +02:00
if ( constructionMarkerBlock ! = null ) {
schemes . registerSchematicBlock ( constructionMarkerBlock , SchematicIgnore . class ) ;
}
2015-09-12 17:43:23 +02:00
2015-04-16 15:08:33 +02:00
schemes . registerSchematicBlock ( frameBlock , SchematicFree . class ) ;
2012-05-09 22:43:05 +02:00
2014-04-13 19:22:41 +02:00
// Factories required to save entities in world
SchematicFactory . registerSchematicFactory ( SchematicBlock . class , new SchematicFactoryBlock ( ) ) ;
2014-04-18 08:50:48 +02:00
SchematicFactory . registerSchematicFactory ( SchematicMask . class , new SchematicFactoryMask ( ) ) ;
SchematicFactory . registerSchematicFactory ( SchematicEntity . class , new SchematicFactoryEntity ( ) ) ;
2014-04-13 19:22:41 +02:00
2015-03-13 14:27:22 +01:00
LibraryAPI . registerHandler ( new LibraryBlueprintTypeHandler ( false ) ) ; // Template
LibraryAPI . registerHandler ( new LibraryBlueprintTypeHandler ( true ) ) ; // Blueprint
LibraryAPI . registerHandler ( new LibraryBookTypeHandler ( ) ) ;
2014-05-02 20:16:20 +02:00
BlueprintDeployer . instance = new RealBlueprintDeployer ( ) ;
2015-03-03 21:47:33 +01:00
architectAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.architect " , " architectAchievement " , 11 , 2 , BuildCraftBuilders . architectBlock , BuildCraftCore . goldGearAchievement ) ) ;
builderAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.builder " , " builderAchievement " , 13 , 2 , BuildCraftBuilders . builderBlock , architectAchievement ) ) ;
blueprintAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.blueprint " , " blueprintAchievement " , 11 , 4 , BuildCraftBuilders . blueprintItem , architectAchievement ) ) ;
templateAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.template " , " templateAchievement " , 13 , 4 , BuildCraftBuilders . templateItem , blueprintAchievement ) ) ;
libraryAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.blueprintLibrary " , " blueprintLibraryAchievement " , 15 , 2 , BuildCraftBuilders . libraryBlock , builderAchievement ) ) ;
2015-04-16 15:08:33 +02:00
chunkDestroyerAchievement = BuildCraftCore . achievementManager . registerAchievement ( new Achievement ( " achievement.chunkDestroyer " , " chunkDestroyerAchievement " , 9 , 2 , quarryBlock , BuildCraftCore . diamondGearAchievement ) ) ;
2015-03-03 21:47:33 +01:00
2012-12-17 23:30:54 +01:00
if ( BuildCraftCore . loadDefaultRecipes ) {
2012-05-09 22:43:05 +02:00
loadRecipes ( ) ;
2012-08-24 19:25:54 +02:00
}
2014-02-21 21:30:12 +01:00
BuilderProxy . proxy . registerBlockRenderers ( ) ;
2012-08-24 19:25:54 +02:00
}
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-11-19 12:54:37 +01:00
public void preInit ( FMLPreInitializationEvent evt ) {
2014-02-15 22:29:48 +01:00
templateItem = new ItemBlueprintTemplate ( ) ;
2013-03-07 00:22:17 +01:00
templateItem . setUnlocalizedName ( " templateItem " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( templateItem , false ) ;
2012-08-24 19:25:54 +02:00
2014-02-15 22:29:48 +01:00
blueprintItem = new ItemBlueprintStandard ( ) ;
2013-03-07 00:22:17 +01:00
blueprintItem . setUnlocalizedName ( " blueprintItem " ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerItem ( blueprintItem , false ) ;
2012-08-24 19:25:54 +02:00
2015-04-16 15:08:33 +02:00
quarryBlock = ( BlockQuarry ) CompatHooks . INSTANCE . getBlock ( BlockQuarry . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( quarryBlock . setBlockName ( " machineBlock " ) , false ) ;
2015-04-16 15:08:33 +02:00
2015-01-17 21:13:58 +01:00
fillerBlock = ( BlockFiller ) CompatHooks . INSTANCE . getBlock ( BlockFiller . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( fillerBlock . setBlockName ( " fillerBlock " ) , false ) ;
2012-08-24 19:25:54 +02:00
2015-04-16 15:08:33 +02:00
frameBlock = new BlockFrame ( ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( frameBlock . setBlockName ( " frameBlock " ) , true ) ;
2015-04-16 15:08:33 +02:00
2015-01-17 21:13:58 +01:00
builderBlock = ( BlockBuilder ) CompatHooks . INSTANCE . getBlock ( BlockBuilder . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( builderBlock . setBlockName ( " builderBlock " ) , false ) ;
2012-08-24 19:25:54 +02:00
2015-01-17 21:13:58 +01:00
architectBlock = ( BlockArchitect ) CompatHooks . INSTANCE . getBlock ( BlockArchitect . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( architectBlock . setBlockName ( " architectBlock " ) , false ) ;
2012-08-24 19:25:54 +02:00
2015-01-17 21:13:58 +01:00
libraryBlock = ( BlockBlueprintLibrary ) CompatHooks . INSTANCE . getBlock ( BlockBlueprintLibrary . class ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . registerBlock ( libraryBlock . setBlockName ( " libraryBlock " ) , false ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileQuarry . class , " Machine " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileMarker . class , " Marker " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileFiller . class , " Filler " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileBuilder . class , " net.minecraft.src.builders.TileBuilder " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileArchitect . class , " net.minecraft.src.builders.TileTemplate " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TilePathMarker . class , " net.minecraft.src.builders.TilePathMarker " ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileBlueprintLibrary . class , " net.minecraft.src.builders.TileBlueprintLibrary " ) ;
constructionMarkerBlock = ( BlockConstructionMarker ) CompatHooks . INSTANCE . getBlock ( BlockConstructionMarker . class ) ;
BCRegistry . INSTANCE . registerBlock ( constructionMarkerBlock . setBlockName ( " constructionMarkerBlock " ) ,
ItemConstructionMarker . class , false ) ;
BCRegistry . INSTANCE . registerTileEntity ( TileConstructionMarker . class , " net.minecraft.src.builders.TileConstructionMarker " ) ;
2015-07-16 08:58:07 +02:00
2014-10-26 12:27:51 +01:00
SchematicRegistry . INSTANCE . readConfiguration ( BuildCraftCore . mainConfiguration ) ;
2014-05-01 16:42:58 +02:00
2013-06-12 15:43:15 +02:00
if ( BuildCraftCore . mainConfiguration . hasChanged ( ) ) {
BuildCraftCore . mainConfiguration . save ( ) ;
2013-03-07 06:31:35 +01:00
}
2012-08-24 19:25:54 +02:00
2013-03-30 02:45:07 +01:00
MinecraftForge . EVENT_BUS . register ( this ) ;
2015-04-02 14:46:57 +02:00
FMLCommonHandler . instance ( ) . bus ( ) . register ( this ) ;
2013-03-30 02:45:07 +01:00
2014-06-13 13:15:33 +02:00
StatementManager . registerActionProvider ( new BuildersActionProvider ( ) ) ;
2012-05-09 22:43:05 +02:00
}
2012-06-04 22:48:18 +02:00
public static void loadRecipes ( ) {
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe (
2015-04-16 15:08:33 +02:00
new ItemStack ( quarryBlock ) ,
" ipi " ,
" gig " ,
" dDd " ,
'i' , " gearIron " ,
'p' , " dustRedstone " ,
'g' , " gearGold " ,
'd' , " gearDiamond " ,
'D' , Items . diamond_pickaxe ) ;
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( templateItem , 1 ) , " ppp " , " pip " , " ppp " , 'i' ,
2015-09-20 11:20:30 +02:00
" dyeBlack " , 'p' , Items . paper ) ;
2012-06-08 02:13:31 +02:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( blueprintItem , 1 ) , " ppp " , " pip " , " ppp " , 'i' ,
2015-09-20 11:20:30 +02:00
" gemLapis " , 'p' , Items . paper ) ;
2012-06-08 02:13:31 +02:00
2015-07-16 08:58:07 +02:00
if ( constructionMarkerBlock ! = null ) {
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( constructionMarkerBlock , 1 ) , " l " , " r " , 'l' ,
2015-07-16 08:58:07 +02:00
" gearGold " , 'r' , Blocks . redstone_torch ) ;
}
2015-01-10 17:03:35 +01:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( fillerBlock , 1 ) , " btb " , " ycy " , " gCg " , 'b' ,
2015-09-20 11:20:30 +02:00
" dyeBlack " , 't' , BuildCraftCore . markerBlock , 'y' , " dyeYellow " ,
'c' , Blocks . crafting_table , 'g' , " gearGold " , 'C' , Blocks . chest ) ;
2012-06-08 02:13:31 +02:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( builderBlock , 1 ) , " btb " , " ycy " , " gCg " , 'b' ,
2015-09-20 11:20:30 +02:00
" dyeBlack " , 't' , BuildCraftCore . markerBlock , 'y' , " dyeYellow " ,
'c' , Blocks . crafting_table , 'g' , " gearDiamond " , 'C' , Blocks . chest ) ;
2013-06-30 09:46:15 +02:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( architectBlock , 1 ) , " btb " , " ycy " , " gCg " , 'b' ,
2015-09-20 11:20:30 +02:00
" dyeBlack " , 't' , BuildCraftCore . markerBlock , 'y' , " dyeYellow " ,
'c' , Blocks . crafting_table , 'g' , " gearDiamond " , 'C' ,
new ItemStack ( blueprintItem , 1 ) ) ;
2013-06-30 09:46:15 +02:00
2015-09-29 09:54:12 +02:00
BCRegistry . INSTANCE . addCraftingRecipe ( new ItemStack ( libraryBlock , 1 ) , " igi " , " bBb " , " iri " , 'B' ,
2015-09-20 09:51:22 +02:00
new ItemStack ( blueprintItem ) , 'b' , Blocks . bookshelf , 'i' , " ingotIron " , 'g' , " gearIron " , 'r' , Items . redstone ) ;
2012-05-09 22:43:05 +02:00
}
2013-11-14 02:23:12 +01:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2013-11-14 02:23:12 +01:00
public void processIMCRequests ( FMLInterModComms . IMCEvent event ) {
InterModComms . processIMC ( event ) ;
}
2012-05-09 22:43:05 +02:00
2014-04-14 18:27:59 +02:00
@Mod.EventHandler
2014-05-03 18:59:52 +02:00
public void serverStop ( FMLServerStoppingEvent event ) {
2012-09-18 13:18:58 +02:00
TilePathMarker . clearAvailableMarkersList ( ) ;
}
2015-09-20 11:20:30 +02:00
@Mod.EventHandler
public void serverAboutToStart ( FMLServerAboutToStartEvent event ) {
String blueprintPath = new File ( DimensionManager . getCurrentSaveRootDirectory ( ) , " buildcraft " + File . separator + " blueprints " ) . getPath ( ) ;
serverDB . init ( new String [ ] { oldBlueprintServerDir , blueprintPath } , blueprintPath ) ;
}
2015-09-20 09:43:49 +02:00
2014-02-08 16:04:03 +01:00
@SubscribeEvent
2013-03-30 02:45:07 +01:00
@SideOnly ( Side . CLIENT )
public void loadTextures ( TextureStitchEvent . Pre evt ) {
2014-02-08 16:04:03 +01:00
if ( evt . map . getTextureType ( ) = = 0 ) {
2015-04-16 15:08:33 +02:00
TextureMap terrainTextures = evt . map ;
BuilderProxyClient . drillTexture = terrainTextures . registerIcon ( " buildcraftbuilders:machineBlock/drill " ) ;
2015-10-01 17:56:37 +02:00
BuilderProxyClient . drillSideTexture = terrainTextures . registerIcon ( " buildcraftbuilders:machineBlock/drill_xz " ) ;
2015-04-16 15:08:33 +02:00
BuilderProxyClient . drillHeadTexture = terrainTextures . registerIcon ( " buildcraftbuilders:machineBlock/drill_head " ) ;
2014-01-18 14:53:09 +01:00
}
}
2014-05-09 19:09:58 +02:00
2014-05-08 21:57:05 +02:00
@Mod.EventHandler
public void whiteListAppliedEnergetics ( FMLInitializationEvent event ) {
FMLInterModComms . sendMessage ( " appliedenergistics2 " , " whitelist-spatial " ,
TileBlueprintLibrary . class . getCanonicalName ( ) ) ;
}
2014-10-21 02:06:57 +02:00
@Mod.EventHandler
public void remap ( FMLMissingMappingsEvent event ) {
2015-09-20 11:20:30 +02:00
for ( FMLMissingMappingsEvent . MissingMapping mapping : event . get ( ) ) {
2015-03-20 10:47:52 +01:00
if ( mapping . name . equals ( " BuildCraft|Builders:buildToolBlock " )
| | mapping . name . equals ( " BuildCraft|Builders:null " ) ) {
2014-10-21 02:06:57 +02:00
if ( mapping . type = = GameRegistry . Type . ITEM ) {
2015-03-20 10:47:52 +01:00
mapping . remap ( Item . getItemFromBlock ( BuildCraftCore . buildToolBlock ) ) ;
2014-10-21 02:06:57 +02:00
} else {
2015-03-20 10:47:52 +01:00
mapping . remap ( BuildCraftCore . buildToolBlock ) ;
2014-10-21 02:06:57 +02:00
}
2015-06-30 19:01:44 +02:00
} else if ( mapping . name . equals ( " BuildCraft|Builders:markerBlock " ) ) {
if ( mapping . type = = GameRegistry . Type . ITEM ) {
mapping . remap ( Item . getItemFromBlock ( BuildCraftCore . markerBlock ) ) ;
} else {
mapping . remap ( BuildCraftCore . markerBlock ) ;
}
} else if ( mapping . name . equals ( " BuildCraft|Builders:pathMarkerBlock " ) ) {
if ( mapping . type = = GameRegistry . Type . ITEM ) {
mapping . remap ( Item . getItemFromBlock ( BuildCraftCore . pathMarkerBlock ) ) ;
} else {
mapping . remap ( BuildCraftCore . pathMarkerBlock ) ;
}
2014-10-21 02:06:57 +02:00
}
}
}
2012-05-09 22:43:05 +02:00
}