initiated a test framework

This commit is contained in:
SpaceToad 2014-05-17 13:31:18 +02:00
parent fe1cbb3c63
commit 5c0acc7b23
3 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/**
* Copyright (c) 2011-2014, 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.tests;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import buildcraft.core.CreativeTabBuildCraft;
public class BlockTestPathfinding extends BlockContainer {
protected BlockTestPathfinding() {
super(Material.ground);
setCreativeTab(CreativeTabBuildCraft.BLOCKS.get());
}
@Override
public TileEntity createNewTileEntity(World var1, int var2) {
return new TileTestPathfinding();
}
}

View file

@ -0,0 +1,35 @@
/**
* Copyright (c) 2011-2014, 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.tests;
import net.minecraft.block.Block;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import buildcraft.BuildCraftMod;
import buildcraft.core.DefaultProps;
import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
@Mod(name = "BuildCraft Tests", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Tests", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftTests extends BuildCraftMod {
public static Block blockTestPathfinding;
@Mod.Instance("BuildCraft|Tests")
public static BuildCraftTests instance;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
blockTestPathfinding = new BlockTestPathfinding();
CoreProxy.proxy.registerBlock(blockTestPathfinding);
CoreProxy.proxy.registerTileEntity(TileTestPathfinding.class, "net.minecraft.src.builders.TileTestPathfinding");
}
}

View file

@ -0,0 +1,43 @@
package buildcraft.tests;
import java.util.ArrayList;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import buildcraft.core.BlockIndex;
import buildcraft.core.utils.PathFinding;
public class TileTestPathfinding extends TileEntity {
static TileTestPathfinding firstEntity = null;
public boolean initialized = false;
@Override
public void updateEntity() {
if (worldObj.isRemote) {
return;
}
if (!initialized) {
initialized = true;
if (firstEntity == null) {
firstEntity = this;
} else {
PathFinding p = new PathFinding(worldObj, new BlockIndex(xCoord, yCoord, zCoord), new BlockIndex(
firstEntity.xCoord, firstEntity.yCoord, firstEntity.zCoord));
p.iterate(100);
ArrayList<BlockIndex> r = p.getResult();
for (BlockIndex b : r) {
worldObj.setBlock(b.x, b.y, b.z, Blocks.sponge);
}
}
}
}
}