Move marker and path marker to Core, close #2834

This commit is contained in:
asiekierka 2015-06-30 19:01:44 +02:00
parent 1c73dd18c7
commit 0a88284e24
16 changed files with 64 additions and 98 deletions

View file

@ -67,14 +67,11 @@ import buildcraft.builders.BlockBuilder;
import buildcraft.builders.BlockConstructionMarker;
import buildcraft.builders.BlockFiller;
import buildcraft.builders.BlockFrame;
import buildcraft.builders.BlockMarker;
import buildcraft.builders.BlockPathMarker;
import buildcraft.builders.BlockQuarry;
import buildcraft.builders.BlueprintServerDatabase;
import buildcraft.builders.BuilderProxy;
import buildcraft.builders.BuilderProxyClient;
import buildcraft.builders.BuildersGuiHandler;
import buildcraft.builders.EventHandlerBuilders;
import buildcraft.builders.HeuristicBlockDetection;
import buildcraft.builders.ItemBlueprintStandard;
import buildcraft.builders.ItemBlueprintTemplate;
@ -87,8 +84,8 @@ import buildcraft.builders.TileBlueprintLibrary;
import buildcraft.builders.TileBuilder;
import buildcraft.builders.TileConstructionMarker;
import buildcraft.builders.TileFiller;
import buildcraft.builders.TileMarker;
import buildcraft.builders.TilePathMarker;
import buildcraft.core.TileMarker;
import buildcraft.core.TilePathMarker;
import buildcraft.builders.TileQuarry;
import buildcraft.builders.blueprints.RealBlueprintDeployer;
import buildcraft.builders.schematics.SchematicAir;
@ -146,8 +143,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
@Mod.Instance("BuildCraft|Builders")
public static BuildCraftBuilders instance;
public static BlockMarker markerBlock;
public static BlockPathMarker pathMarkerBlock;
public static BlockConstructionMarker constructionMarkerBlock;
public static BlockFiller fillerBlock;
public static BlockBuilder builderBlock;
@ -350,12 +345,8 @@ public class BuildCraftBuilders extends BuildCraftMod {
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
// Register gui handler
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new BuildersGuiHandler());
// Register save handler
MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders());
// Standard blocks
ISchematicRegistry schemes = BuilderAPI.schematicRegistry;
schemes.registerSchematicBlock(Blocks.air, SchematicAir.class);
@ -503,9 +494,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
schemes.registerSchematicBlock(architectBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
schemes.registerSchematicBlock(builderBlock, SchematicRotateMeta.class, new int[]{2, 5, 3, 4}, true);
// Landmarks are often caught incorrectly, making building them counter-productive.
schemes.registerSchematicBlock(markerBlock, SchematicIgnore.class);
schemes.registerSchematicBlock(pathMarkerBlock, SchematicIgnore.class);
schemes.registerSchematicBlock(constructionMarkerBlock, SchematicIgnore.class);
schemes.registerSchematicBlock(frameBlock, SchematicFree.class);
@ -548,12 +536,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
quarryBlock = (BlockQuarry) CompatHooks.INSTANCE.getBlock(BlockQuarry.class);
CoreProxy.proxy.registerBlock(quarryBlock.setBlockName("machineBlock"));
markerBlock = (BlockMarker) CompatHooks.INSTANCE.getBlock(BlockMarker.class);
CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));
pathMarkerBlock = (BlockPathMarker) CompatHooks.INSTANCE.getBlock(BlockPathMarker.class);
CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));
constructionMarkerBlock = (BlockConstructionMarker) CompatHooks.INSTANCE.getBlock(BlockConstructionMarker.class);
CoreProxy.proxy.registerBlock(constructionMarkerBlock.setBlockName("constructionMarkerBlock"),
ItemConstructionMarker.class);
@ -618,25 +600,19 @@ public class BuildCraftBuilders extends BuildCraftMod {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(blueprintItem, 1), "ppp", "pip", "ppp", 'i',
new ItemStack(Items.dye, 1, 4), 'p', Items.paper);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(markerBlock, 1), "l ", "r ", 'l',
new ItemStack(Items.dye, 1, 4), 'r', Blocks.redstone_torch);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pathMarkerBlock, 1), "l ", "r ", 'l',
"dyeGreen", 'r', Blocks.redstone_torch);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(constructionMarkerBlock, 1), "l ", "r ", 'l',
"gearGold", 'r', Blocks.redstone_torch);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(fillerBlock, 1), "btb", "ycy", "gCg", 'b',
"dyeBlack", 't', markerBlock, 'y', "dyeYellow",
"dyeBlack", 't', BuildCraftCore.markerBlock, 'y', "dyeYellow",
'c', Blocks.crafting_table, 'g', "gearGold", 'C', Blocks.chest);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(builderBlock, 1), "btb", "ycy", "gCg", 'b',
"dyeBlack", 't', markerBlock, 'y', "dyeYellow",
"dyeBlack", 't', BuildCraftCore.markerBlock, 'y', "dyeYellow",
'c', Blocks.crafting_table, 'g', "gearDiamond", 'C', Blocks.chest);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(architectBlock, 1), "btb", "ycy", "gCg", 'b',
"dyeBlack", 't', markerBlock, 'y', "dyeYellow",
"dyeBlack", 't', BuildCraftCore.markerBlock, 'y', "dyeYellow",
'c', Blocks.crafting_table, 'g', "gearDiamond", 'C',
new ItemStack(blueprintItem, 1));
@ -668,16 +644,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
@Mod.EventHandler
public void whiteListAppliedEnergetics(FMLInitializationEvent event) {
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileMarker.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileFiller.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileBuilder.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileArchitect.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TilePathMarker.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileBlueprintLibrary.class.getCanonicalName());
}
@ -692,6 +658,18 @@ public class BuildCraftBuilders extends BuildCraftMod {
} else {
mapping.remap(BuildCraftCore.buildToolBlock);
}
} 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);
}
}
}
}

View file

@ -75,6 +75,8 @@ import buildcraft.core.AchievementManager;
import buildcraft.core.BCCreativeTab;
import buildcraft.core.BlockBuildTool;
import buildcraft.core.BlockEngine;
import buildcraft.core.BlockMarker;
import buildcraft.core.BlockPathMarker;
import buildcraft.core.BlockSpring;
import buildcraft.core.CompatHooks;
import buildcraft.core.CoreGuiHandler;
@ -93,6 +95,7 @@ import buildcraft.core.SchematicEngine;
import buildcraft.core.SpringPopulate;
import buildcraft.core.TickHandlerCore;
import buildcraft.core.TileEngineWood;
import buildcraft.core.TilePathMarker;
import buildcraft.core.Version;
import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.builders.patterns.FillerPattern;
@ -110,6 +113,7 @@ import buildcraft.core.builders.patterns.PatternParameterXZDir;
import buildcraft.core.builders.patterns.PatternParameterYDir;
import buildcraft.core.builders.patterns.PatternPyramid;
import buildcraft.core.builders.patterns.PatternStairs;
import buildcraft.core.builders.schematics.SchematicIgnore;
import buildcraft.core.command.SubCommandChangelog;
import buildcraft.core.command.SubCommandVersion;
import buildcraft.core.config.BuildCraftConfiguration;
@ -193,6 +197,8 @@ public class BuildCraftCore extends BuildCraftMod {
public static ConfigManager mainConfigManager;
public static BlockEngine engineBlock;
public static BlockMarker markerBlock;
public static BlockPathMarker pathMarkerBlock;
public static Block springBlock;
public static BlockBuildTool buildToolBlock;
public static Item woodenGearItem;
@ -283,7 +289,7 @@ public class BuildCraftCore extends BuildCraftMod {
BuildcraftRecipeRegistry.programmingTable = ProgrammingRecipeManager.INSTANCE;
BuilderAPI.schematicRegistry = SchematicRegistry.INSTANCE;
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.cfg"));
mainConfigManager = new ConfigManager(mainConfiguration);
mainConfiguration.load();
@ -365,6 +371,12 @@ public class BuildCraftCore extends BuildCraftMod {
engineBlock.registerTile((Class<? extends TileEngineBase>) CompatHooks.INSTANCE.getTile(TileEngineWood.class), "tile.engineWood");
CoreProxy.proxy.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood");
markerBlock = (BlockMarker) CompatHooks.INSTANCE.getBlock(BlockMarker.class);
CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));
pathMarkerBlock = (BlockPathMarker) CompatHooks.INSTANCE.getBlock(BlockPathMarker.class);
CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
@ -494,7 +506,11 @@ public class BuildCraftCore extends BuildCraftMod {
BuildCraftAPI.registerWorldProperty("shoveled", new WorldPropertyIsShoveled());
BuildCraftAPI.registerWorldProperty("dirt", new WorldPropertyIsDirt());
BuildCraftAPI.registerWorldProperty("fluidSource", new WorldPropertyIsFluidSource());
// Landmarks are often caught incorrectly, making building them counter-productive.
SchematicRegistry.INSTANCE.registerSchematicBlock(markerBlock, SchematicIgnore.class);
SchematicRegistry.INSTANCE.registerSchematicBlock(pathMarkerBlock, SchematicIgnore.class);
ColorUtils.initialize();
actionControl = new IActionExternal[IControllable.Mode.values().length];
@ -624,6 +640,12 @@ public class BuildCraftCore extends BuildCraftMod {
"www", " g ", "GpG", 'w', "plankWood", 'g', "blockGlass", 'G',
"gearWood", 'p', Blocks.piston);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(markerBlock, 1), "l ", "r ", 'l',
new ItemStack(Items.dye, 1, 4), 'r', Blocks.redstone_torch);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pathMarkerBlock, 1), "l ", "r ", 'l',
"dyeGreen", 'r', Blocks.redstone_torch);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(paintbrushItem), " iw", " gi", "s ",
's', "stickWood", 'g', "gearWood", 'w', new ItemStack(Blocks.wool, 1, 0), 'i', Items.string);
@ -705,9 +727,12 @@ public class BuildCraftCore extends BuildCraftMod {
}
@SubscribeEvent
public void cleanRegistries(WorldEvent.Unload unload) {
public void cleanRegistries(WorldEvent.Unload event) {
for (IWorldProperty property : BuildCraftAPI.worldProperties.values()) {
property.clear();
}
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
TilePathMarker.clearAvailableMarkersList(event.world);
}
}
}

View file

@ -18,6 +18,7 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.BlockMarker;
import buildcraft.core.lib.utils.BlockUtils;
import buildcraft.core.lib.utils.Utils;

View file

@ -40,7 +40,6 @@ public class BuilderProxyClient extends BuilderProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileUrbanist.class, new RenderBoxProvider());
ClientRegistry.bindTileEntitySpecialRenderer(TileBuilder.class, new RenderBuilderTile());
ClientRegistry.bindTileEntitySpecialRenderer(TilePathMarker.class, new RenderPathMarker());
ClientRegistry.bindTileEntitySpecialRenderer(TileConstructionMarker.class, new RenderConstructionMarker());
ClientRegistry.bindTileEntitySpecialRenderer(TileFiller.class, new RenderMultiTESR(new TileEntitySpecialRenderer[] {

View file

@ -1,36 +0,0 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* 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
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.event.world.WorldEvent;
public class EventHandlerBuilders {
@SubscribeEvent
public void handleWorldLoad(WorldEvent.Load event) {
// Temporary solution
// Please remove the world Load event when world Unload event gets implimented
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
TilePathMarker.clearAvailableMarkersList(event.world);
}
}
@SubscribeEvent
public void handleWorldUnload(WorldEvent.Unload event) {
// When a world unloads clean from the list of available markers the ones
// that were on the unloaded world
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
TilePathMarker.clearAvailableMarkersList(event.world);
}
}
}

View file

@ -49,6 +49,7 @@ import buildcraft.builders.blueprints.RecursiveBlueprintBuilder;
import buildcraft.core.Box;
import buildcraft.core.Box.Kind;
import buildcraft.core.LaserData;
import buildcraft.core.TilePathMarker;
import buildcraft.core.blueprints.Blueprint;
import buildcraft.core.blueprints.BlueprintBase;
import buildcraft.core.blueprints.BptBuilderBase;
@ -259,7 +260,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
for (BlockIndex b : path) {
worldObj.setBlockToAir(b.x, b.y, b.z);
BuildCraftBuilders.pathMarkerBlock.dropBlockAsItem(
BuildCraftCore.pathMarkerBlock.dropBlockAsItem(
worldObj, b.x, b.y, b.z,
0, 0);
}

View file

@ -27,6 +27,7 @@ import buildcraft.api.tiles.IControllable;
import buildcraft.api.tiles.IHasWork;
import buildcraft.core.Box;
import buildcraft.core.Box.Kind;
import buildcraft.core.TileMarker;
import buildcraft.core.blueprints.BptBuilderTemplate;
import buildcraft.core.blueprints.BptContext;
import buildcraft.core.builders.TileAbstractBuilder;

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
package buildcraft.core;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -19,7 +19,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftCore;
import buildcraft.api.items.IMapLocation;
import buildcraft.core.BCCreativeTab;
import buildcraft.core.lib.block.BlockBuildCraft;
public class BlockMarker extends BlockBuildCraft {

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
package buildcraft.core;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
package buildcraft.core;
import org.lwjgl.opengl.GL11;
@ -16,8 +16,6 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import buildcraft.core.EntityLaser;
import buildcraft.core.LaserData;
import buildcraft.core.render.RenderLaser;
public class RenderPathMarker extends TileEntitySpecialRenderer {

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
package buildcraft.core;
import io.netty.buffer.ByteBuf;
@ -15,12 +15,10 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import buildcraft.BuildCraftBuilders;
import buildcraft.BuildCraftCore;
import buildcraft.api.core.ISerializable;
import buildcraft.api.core.Position;
import buildcraft.api.tiles.ITileAreaProvider;
import buildcraft.core.DefaultProps;
import buildcraft.core.LaserKind;
import buildcraft.core.lib.EntityBlock;
import buildcraft.core.lib.block.TileBuildCraft;
import buildcraft.core.lib.utils.Utils;
@ -222,7 +220,7 @@ public class TileMarker extends TileBuildCraft implements ITileAreaProvider {
Block block = worldObj.getBlock(coords[0], coords[1], coords[2]);
if (block == BuildCraftBuilders.markerBlock) {
if (block == BuildCraftCore.markerBlock) {
TileMarker marker = (TileMarker) worldObj.getTileEntity(coords[0], coords[1], coords[2]);
if (linkTo(marker, n)) {
@ -235,7 +233,7 @@ public class TileMarker extends TileBuildCraft implements ITileAreaProvider {
block = worldObj.getBlock(coords[0], coords[1], coords[2]);
if (block == BuildCraftBuilders.markerBlock) {
if (block == BuildCraftCore.markerBlock) {
TileMarker marker = (TileMarker) worldObj.getTileEntity(coords[0], coords[1], coords[2]);
if (linkTo(marker, n)) {
@ -459,13 +457,13 @@ public class TileMarker extends TileBuildCraft implements ITileAreaProvider {
if (m.isSet()) {
worldObj.setBlockToAir(m.x, m.y, m.z);
BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, m.x, m.y, m.z, 0, 0);
BuildCraftCore.markerBlock.dropBlockAsItem(worldObj, m.x, m.y, m.z, 0, 0);
}
}
worldObj.setBlockToAir(o.vectO.x, o.vectO.y, o.vectO.z);
BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, o.vectO.x, o.vectO.y, o.vectO.z, 0, 0);
BuildCraftCore.markerBlock.dropBlockAsItem(worldObj, o.vectO.x, o.vectO.y, o.vectO.z, 0, 0);
}
@Override

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
package buildcraft.core;
import java.util.HashSet;
import java.util.Iterator;
@ -21,8 +21,6 @@ import net.minecraft.world.World;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.IPathProvider;
import buildcraft.api.core.Position;
import buildcraft.core.DefaultProps;
import buildcraft.core.LaserData;
public class TilePathMarker extends TileMarker implements IPathProvider {
// A list with the pathMarkers that aren't fully connected
@ -275,6 +273,7 @@ public class TilePathMarker extends TileMarker implements IPathProvider {
@Override
public void onChunkUnload() {
super.onChunkUnload();
availableMarkers.remove(this);
}
@ -285,7 +284,7 @@ public class TilePathMarker extends TileMarker implements IPathProvider {
public static void clearAvailableMarkersList(World w) {
for (Iterator<TilePathMarker> it = availableMarkers.iterator(); it.hasNext();) {
TilePathMarker t = it.next();
if (t.getWorldObj().provider.dimensionId != w.provider.dimensionId) {
if (t.getWorldObj().provider.dimensionId == w.provider.dimensionId) {
it.remove();
}
}

View file

@ -27,6 +27,8 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
import buildcraft.BuildCraftCore;
import buildcraft.core.LaserKind;
import buildcraft.core.RenderPathMarker;
import buildcraft.core.TilePathMarker;
import buildcraft.core.lib.EntityBlock;
import buildcraft.core.lib.engines.RenderEngine;
import buildcraft.core.lib.engines.TileEngineBase;
@ -89,6 +91,7 @@ public class CoreProxyClient extends CoreProxy {
RenderingRegistry.registerBlockHandler(BuildCraftCore.legacyPipeModel, new RenderingEntityBlocks());
RenderingRegistry.registerBlockHandler(new RenderingMarkers());
RenderingRegistry.registerBlockHandler(BuildCraftCore.complexBlockModel, new RenderBlockComplex());
ClientRegistry.bindTileEntitySpecialRenderer(TilePathMarker.class, new RenderPathMarker());
//TODO Update me to grab differing trunk textures
ClientRegistry.bindTileEntitySpecialRenderer(TileEngineBase.class, new RenderEngine());