Converted Breeding Reactor Schematic to scala

This commit is contained in:
Robert S 2014-10-04 16:27:22 -04:00
parent 30ad8d98cf
commit b14bda2e5f
2 changed files with 64 additions and 68 deletions

View file

@ -1,68 +0,0 @@
package resonantinduction.atomic.schematic;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.core.transform.vector.Vector3;
import java.util.HashMap;
public class SchematicBreedingReactor extends Schematic
{
@Override
public String getName()
{
return "schematic.breedingReactor.name";
}
@Override
public HashMap<Vector3, Pair<Block, Integer>> getStructure(ForgeDirection dir, int size)
{
HashMap<Vector3, Pair<Block, Integer>> returnMap = new HashMap<Vector3, Pair<Block, Integer>>();
int r = Math.max(size, 2);
for (int x = -r; x <= r; x++)
{
for (int z = -r; z <= r; z++)
{
returnMap.put(new Vector3(x, 0, z), new Pair(Blocks.water, 0));
}
}
r--;
for (int x = -r; x <= r; x++)
{
for (int z = -r; z <= r; z++)
{
Vector3 targetPosition = new Vector3(x, 1, z);
if (new Vector3(x, 0, z).magnitude() <= 2)
{
if (!((x == -r || x == r) && (z == -r || z == r)))
{
returnMap.put(new Vector3(x, 0, z), new Pair(AtomicContent.blockReactorCell(), 0));
returnMap.put(new Vector3(x, -1, z), new Pair(AtomicContent.blockThermometer(), 0));
returnMap.put(new Vector3(x, -3, z), new Pair(AtomicContent.blockSiren(), 0));
returnMap.put(new Vector3(x, -2, z), new Pair(Blocks.redstone_wire, 0));
}
else
{
returnMap.put(new Vector3(x, -1, z), new Pair(AtomicContent.blockControlRod(), 0));
returnMap.put(new Vector3(x, -2, z), new Pair(Blocks.piston, 1));
}
}
}
}
returnMap.put(new Vector3(0, -2, 0), new Pair(Blocks.stone, 0));
returnMap.put(new Vector3(0, -3, 0), new Pair(Blocks.stone, 0));
returnMap.put(new Vector3(), new Pair(AtomicContent.blockReactorCell(), 0));
return returnMap;
}
}

View file

@ -0,0 +1,64 @@
package resonantinduction.atomic.schematic
import java.util.HashMap
import net.minecraft.block.Block
import net.minecraft.init.Blocks
import net.minecraftforge.common.util.ForgeDirection
import resonant.lib.`type`.Pair
import resonant.lib.schematic.Schematic
import resonantinduction.atomic.AtomicContent
import universalelectricity.core.transform.vector.Vector3
class SchematicBreedingReactor extends Schematic
{
override def getName: String =
{
return "schematic.breedingReactor.name"
}
override def getStructure(dir: ForgeDirection, size: Int): HashMap[Vector3, Pair[Block, Integer]] =
{
val returnMap: HashMap[Vector3, Pair[Block, Integer]] = new HashMap[Vector3, Pair[Block, Integer]]
var r: Int = Math.max(size, 2)
for (x <- -r to r)
{
for (z <- -r to r)
{
returnMap.put(new Vector3(x, 0, z), new Pair[Block, Integer](Blocks.water, 0))
}
}
r -= 1
for (x <- -r to r)
{
for (z <- -r to r)
{
val targetPosition: Vector3 = new Vector3(x, 1, z)
if (new Vector3(x, 0, z).magnitude <= 2)
{
if (!((x == -r || x == r) && (z == -r || z == r)))
{
returnMap.put(new Vector3(x, 0, z), new Pair[Block, Integer](AtomicContent.blockReactorCell, 0))
returnMap.put(new Vector3(x, -1, z), new Pair[Block, Integer](AtomicContent.blockThermometer, 0))
returnMap.put(new Vector3(x, -3, z), new Pair[Block, Integer](AtomicContent.blockSiren, 0))
returnMap.put(new Vector3(x, -2, z), new Pair[Block, Integer](Blocks.redstone_wire, 0))
}
else
{
returnMap.put(new Vector3(x, -1, z), new Pair[Block, Integer](AtomicContent.blockControlRod, 0))
returnMap.put(new Vector3(x, -2, z), new Pair[Block, Integer](Blocks.piston, 1))
}
}
}
}
returnMap.put(new Vector3(0, -2, 0), new Pair[Block, Integer](Blocks.stone, 0))
returnMap.put(new Vector3(0, -3, 0), new Pair[Block, Integer](Blocks.stone, 0))
returnMap.put(new Vector3, new Pair[Block, Integer](AtomicContent.blockReactorCell, 0))
return returnMap
}
}