Started convergence on a pre-alpha release.

Science book is deactivated.
Redstone parameter mechanics have been removed, all replaced by gates.
This commit is contained in:
SpaceToad 2014-08-03 12:19:58 +02:00
parent 8a0222a2ff
commit 6c88ad2ae8
36 changed files with 25 additions and 571 deletions

View file

@ -1,20 +0,0 @@
/**
* 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.api.boards;
import net.minecraft.nbt.NBTTagCompound;
public interface IBoardParameter {
String getName();
void writeToNBT(NBTTagCompound nbt);
void readFromNBT(NBTTagCompound nbt);
}

View file

@ -1,14 +0,0 @@
/**
* 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.api.boards;
public interface IBoardParameterArea extends IBoardParameter {
}

View file

@ -1,14 +0,0 @@
/**
* 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.api.boards;
public interface IBoardParameterPath extends IBoardParameter {
}

View file

@ -1,14 +0,0 @@
/**
* 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.api.boards;
public interface IBoardParameterPosition extends IBoardParameter {
}

View file

@ -1,19 +0,0 @@
/**
* 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.api.boards;
import net.minecraft.item.ItemStack;
public interface IBoardParameterStack extends IBoardParameter {
ItemStack getStack();
void setStack(ItemStack stack);
}

View file

@ -1,14 +0,0 @@
/**
* 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.api.boards;
public interface IBoardParameterString extends IBoardParameter {
}

View file

@ -15,7 +15,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
@ -39,35 +38,8 @@ public abstract class RedstoneBoardNBT<T> {
@SideOnly(Side.CLIENT)
public abstract IIcon getIcon(NBTTagCompound nbt);
public abstract void createRandomBoard(NBTTagCompound nbt);
public abstract void createDefaultBoard(NBTTagCompound nbt);
public IBoardParameter[] getParameters(NBTTagCompound nbt) {
NBTTagList paramsNBT = nbt.getTagList("parameters", Constants.NBT.TAG_COMPOUND);
IBoardParameter[] result = new IBoardParameter[paramsNBT.tagCount()];
for (int i = 0; i < paramsNBT.tagCount(); ++i) {
NBTTagCompound subNBT = paramsNBT.getCompoundTagAt(i);
IBoardParameter p = RedstoneBoardRegistry.instance.createParameter(subNBT.getString("kind"));
p.readFromNBT(subNBT);
result[i] = p;
}
return result;
}
public void setParameters(NBTTagCompound nbt, IBoardParameter[] params) {
NBTTagList paramsNBT = new NBTTagList();
for (IBoardParameter p : params) {
NBTTagCompound subNBT = new NBTTagCompound();
subNBT.setString("kind", RedstoneBoardRegistry.instance.getKindForParam(p));
p.writeToNBT(subNBT);
paramsNBT.appendTag(subNBT);
}
nbt.setTag("parameters", paramsNBT);
public void createBoard(NBTTagCompound nbt) {
nbt.setString("id", getID());
}
public int getParameterNumber(NBTTagCompound nbt) {

View file

@ -27,11 +27,5 @@ public abstract class RedstoneBoardRegistry {
public abstract void registerIcons(IIconRegister par1IconRegister);
public abstract IBoardParameterStack createParameter(String kind);
public abstract IBoardParameterStack createParameterStack();
public abstract String getKindForParam(IBoardParameter param);
public abstract Collection<RedstoneBoardNBT<?>> getAllBoardNBTs();
}

View file

@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency
apply plugin: 'maven' // for uploading to a maven repo
apply plugin: 'checkstyle'
version = "6.0.17"
version = "6.1.0"
group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]

View file

@ -319,8 +319,10 @@ public class BuildCraftCore extends BuildCraftMod {
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
consumeWater.comment = "set to true if the Pump should consume water";
scienceBookItem = (new ItemScienceBook()).setUnlocalizedName("scienceBook");
CoreProxy.proxy.registerItem(scienceBookItem);
if (!NONRELEASED_BLOCKS) {
scienceBookItem = (new ItemScienceBook()).setUnlocalizedName("scienceBook");
CoreProxy.proxy.registerItem(scienceBookItem);
}
woodenGearItem = (new ItemGear(10 * 20)).setUnlocalizedName("woodenGearItem");
CoreProxy.proxy.registerItem(woodenGearItem);
@ -586,8 +588,11 @@ public class BuildCraftCore extends BuildCraftMod {
}
public void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(scienceBookItem), "R ", "B ", 'R', Blocks.redstone_torch, 'B',
Items.book);
if (!NONRELEASED_BLOCKS) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(scienceBookItem), "R ", "B ", 'R', Blocks.redstone_torch, 'B',
Items.book);
}
CoreProxy.proxy.addCraftingRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', Items.iron_ingot, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(Tier.WoodenGear.getTechnology(), new ItemStack(woodenGearItem), " S ", "S S",
" S ", 'S',

View file

@ -802,6 +802,10 @@ public class BuildCraftTransport extends BuildCraftMod {
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:pipePlug", 1000, new ItemStack(plugItem, 8),
new ItemStack(pipeStructureCobblestone));
CoreProxy.proxy.addCraftingRecipe(new ItemStack(robotStationItem), " ", " I ", "ICI",
'I', Items.iron_ingot,
'C', Chipset.GOLD.getStack());
}
@Mod.EventHandler

View file

@ -33,8 +33,6 @@ public final class GuiIds {
public static final int FILTERED_BUFFER = 60;
public static final int REDSTONE_BOARD = 70;
public static final int SCIENCE_BOOK = 70;
/**

View file

@ -87,7 +87,6 @@ public class AIRobotGotoBlock extends AIRobotGoto {
} else {
if (pathSearchJob.isDone()) {
path = pathSearch.getResult();
lastBlockInPath = path.getLast();
if (path.size() == 0) {
unreachable = true;
@ -95,6 +94,8 @@ public class AIRobotGotoBlock extends AIRobotGoto {
return;
}
lastBlockInPath = path.getLast();
setNextInPath();
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotBomberNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotBuilderNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotButcherNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotCarrierNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotFarmerNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -60,16 +60,6 @@ public final class BoardRobotHarvesterNBT extends RedstoneBoardRobotNBT {
icon = iconRegister.registerIcon("buildcraft:board_blue");
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
@Override
public ResourceLocation getRobotTexture() {
return TEXTURE;

View file

@ -61,12 +61,4 @@ public final class BoardRobotKnightNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotLeaveCutterNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound itemData) {
}
}

View file

@ -21,7 +21,6 @@ import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.DefaultProps;
import buildcraft.core.utils.NBTUtils;
import buildcraft.core.utils.StringUtils;
public final class BoardRobotLumberjackNBT extends RedstoneBoardRobotNBT {
@ -44,10 +43,6 @@ public final class BoardRobotLumberjackNBT extends RedstoneBoardRobotNBT {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(StringUtils.localize("buildcraft.boardRobotLumberjack"));
NBTTagCompound nbt = NBTUtils.getItemData(stack);
list.add(StringUtils.localize("buildcraft.boardDetail.range") + ": " + nbt.getInteger("range"));
}
@Override
@ -65,18 +60,6 @@ public final class BoardRobotLumberjackNBT extends RedstoneBoardRobotNBT {
icon = iconRegister.registerIcon("buildcraft:board_blue");
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
int range = (int) Math.floor(nextFloat(10) * 500) + 10;
nbt.setInteger("range", range);
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
nbt.setInteger("range", 250);
}
@Override
public ResourceLocation getRobotTexture() {
return TEXTURE;

View file

@ -61,12 +61,4 @@ public final class BoardRobotMinerNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound itemData) {
}
}

View file

@ -13,7 +13,6 @@ import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.boards.IBoardParameter;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.AIRobot;
@ -32,8 +31,6 @@ public class BoardRobotPicker extends RedstoneBoardRobot {
public static Set<Integer> targettedItems = new HashSet<Integer>();
private NBTTagCompound data;
private IBoardParameter[] params;
private int range;
public BoardRobotPicker(EntityRobotBase iRobot) {
super(iRobot);
@ -42,12 +39,11 @@ public class BoardRobotPicker extends RedstoneBoardRobot {
public BoardRobotPicker(EntityRobotBase robot, NBTTagCompound nbt) {
super(robot);
data = nbt;
range = nbt.getInteger("range");
}
@Override
public void update() {
startDelegateAI(new AIRobotFetchItem(robot, range, ActionRobotFilter.getGateFilter(robot
startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot
.getLinkedStation()), robot.getZoneToWork()));
}
@ -59,7 +55,7 @@ public class BoardRobotPicker extends RedstoneBoardRobot {
if (fetching.itemPickupCancelled || fetching.target != null) {
// if we find an item - that may have been cancelled.
// let's try to get another one
startDelegateAI(new AIRobotFetchItem(robot, range, ActionRobotFilter.getGateFilter(robot
startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot
.getLinkedStation()), robot.getZoneToWork()));
} else if (robot.containsItems()) {
startDelegateAI(new AIRobotGotoStationToUnload(robot, null));
@ -85,14 +81,10 @@ public class BoardRobotPicker extends RedstoneBoardRobot {
@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt);
nbt.setInteger("range", range);
}
@Override
public void loadSelfFromNBT(NBTTagCompound nbt) {
super.loadSelfFromNBT(nbt);
range = nbt.getInteger("range");
}
}

View file

@ -21,7 +21,6 @@ import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.robots.EntityRobot;
import buildcraft.core.utils.NBTUtils;
import buildcraft.core.utils.StringUtils;
public final class BoardRobotPickerNBT extends RedstoneBoardRobotNBT {
@ -41,9 +40,6 @@ public final class BoardRobotPickerNBT extends RedstoneBoardRobotNBT {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(StringUtils.localize("buildcraft.boardRobotPicker"));
NBTTagCompound nbt = NBTUtils.getItemData(stack);
list.add(StringUtils.localize("buildcraft.boardDetail.range") + ": " + nbt.getInteger("range"));
}
@Override
@ -61,17 +57,6 @@ public final class BoardRobotPickerNBT extends RedstoneBoardRobotNBT {
icon = iconRegister.registerIcon("buildcraft:board_green");
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
int range = (int) Math.floor(nextFloat(10) * 500) + 10;
nbt.setInteger("range", range);
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
nbt.setInteger("range", 250);
}
@Override
public ResourceLocation getRobotTexture() {
return EntityRobot.ROBOT_TRANSPORT;

View file

@ -61,12 +61,4 @@ public final class BoardRobotPlanterNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound nbt) {
}
}

View file

@ -61,12 +61,4 @@ public final class BoardRobotShovelmanNBT extends RedstoneBoardRobotNBT {
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
@Override
public void createRandomBoard(NBTTagCompound nbt) {
}
@Override
public void createDefaultBoard(NBTTagCompound itemData) {
}
}

View file

@ -49,8 +49,7 @@ public class TechnoRobot extends Technology {
robot = iRobot;
ItemStack robotStack = new ItemStack(BuildCraftSilicon.robotItem);
NBTTagCompound nbt = NBTUtils.getItemData(robotStack);
nbt.setString("id", robot.getID());
robot.createDefaultBoard(nbt);
robot.createBoard(nbt);
robotItem = ItemRobot.createRobotStack(robotStack);
}

View file

@ -43,7 +43,8 @@ public class PathFindingJob extends Thread {
pathFinding.iterate();
elapsedtime = new Date().getTime() - startTime;
sleep(elapsedtime);
double timeToWait = elapsedtime * 1.5;
sleep((long) timeToWait);
}
} catch (Throwable t) {
t.printStackTrace();

View file

@ -14,24 +14,17 @@ import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import buildcraft.core.GuiIds;
import buildcraft.silicon.gui.ContainerAdvancedCraftingTable;
import buildcraft.silicon.gui.ContainerAssemblyTable;
import buildcraft.silicon.gui.ContainerIntegrationTable;
import buildcraft.silicon.gui.ContainerRedstoneBoard;
import buildcraft.silicon.gui.GuiAdvancedCraftingTable;
import buildcraft.silicon.gui.GuiAssemblyTable;
import buildcraft.silicon.gui.GuiIntegrationTable;
import buildcraft.silicon.gui.GuiRedstoneBoard;
public class GuiHandler implements IGuiHandler {
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == GuiIds.REDSTONE_BOARD) {
return new GuiRedstoneBoard(player, x, y, z);
}
if (!world.blockExists(x, y, z)) {
return null;
}
@ -68,11 +61,6 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == GuiIds.REDSTONE_BOARD) {
return new ContainerRedstoneBoard(player, x, y, z);
}
if (!world.blockExists(x, y, z)) {
return null;
}
@ -102,9 +90,6 @@ public class GuiHandler implements IGuiHandler {
return new ContainerIntegrationTable(player.inventory, (TileIntegrationTable) tile);
}
case GuiIds.REDSTONE_BOARD:
return new ContainerRedstoneBoard(player, x, y, z);
default:
return null;
}

View file

@ -17,7 +17,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,7 +25,6 @@ import buildcraft.BuildCraftSilicon;
import buildcraft.api.boards.RedstoneBoardNBT;
import buildcraft.api.boards.RedstoneBoardRegistry;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.GuiIds;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.utils.NBTUtils;
@ -77,15 +75,6 @@ public class ItemRedstoneBoard extends ItemBuildCraft {
RedstoneBoardRegistry.instance.registerIcons(par1IconRegister);
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World world, EntityPlayer entityPlayer) {
if (!world.isRemote) {
entityPlayer.openGui(BuildCraftSilicon.instance, GuiIds.REDSTONE_BOARD, world, 0, 0, 0);
}
return par1ItemStack;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
@SideOnly(Side.CLIENT)
@ -93,8 +82,7 @@ public class ItemRedstoneBoard extends ItemBuildCraft {
for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) {
ItemStack stack = new ItemStack(BuildCraftSilicon.redstoneBoard);
NBTTagCompound nbtData = NBTUtils.getItemData(stack);
nbtData.setString("id", nbt.getID());
nbt.createDefaultBoard(nbtData);
nbt.createBoard(nbtData);
itemList.add(stack.copy());
}
}

View file

@ -1,26 +0,0 @@
/**
* 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.silicon.boards;
import buildcraft.api.boards.IBoardParameter;
public abstract class BoardParameter implements IBoardParameter {
private String name = "<unnamed>";
@Override
public final String getName () {
return name;
}
public void setName(String iName) {
name = iName;
}
}

View file

@ -1,44 +0,0 @@
/**
* 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.silicon.boards;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.boards.IBoardParameterStack;
public class BoardParameterStack extends BoardParameter implements IBoardParameterStack {
ItemStack stack;
@Override
public ItemStack getStack() {
return stack;
}
@Override
public void setStack(ItemStack iStack) {
stack = iStack;
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
if (stack != null) {
NBTTagCompound stackNBT = new NBTTagCompound();
stack.writeToNBT(stackNBT);
nbt.setTag("stack", stackNBT);
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
if (nbt.hasKey("stack")) {
stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stack"));
}
}
}

View file

@ -16,8 +16,6 @@ import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.boards.IBoardParameter;
import buildcraft.api.boards.IBoardParameterStack;
import buildcraft.api.boards.RedstoneBoardNBT;
import buildcraft.api.boards.RedstoneBoardRegistry;
@ -54,8 +52,7 @@ public class ImplRedstoneBoardRegistry extends RedstoneBoardRegistry {
accumulatedSearch += f.probability;
if (accumulatedSearch > value) {
nbt.setString("id", f.boardNBT.getID());
f.boardNBT.createRandomBoard(nbt);
f.boardNBT.createBoard(nbt);
return;
}
}
@ -84,29 +81,6 @@ public class ImplRedstoneBoardRegistry extends RedstoneBoardRegistry {
}
}
@Override
public IBoardParameterStack createParameterStack() {
return new BoardParameterStack();
}
@Override
public IBoardParameterStack createParameter(String kind) {
if ("stack".equals(kind)) {
return createParameterStack();
} else {
return null;
}
}
@Override
public String getKindForParam(IBoardParameter param) {
if (param instanceof BoardParameterStack) {
return "stack";
} else {
return null;
}
}
@Override
public Collection<RedstoneBoardNBT<?>> getAllBoardNBTs() {
ArrayList<RedstoneBoardNBT<?>> result = new ArrayList<RedstoneBoardNBT<?>>();

View file

@ -1,63 +0,0 @@
/**
* 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.silicon.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.boards.IBoardParameter;
import buildcraft.api.boards.IBoardParameterStack;
import buildcraft.api.boards.RedstoneBoardNBT;
import buildcraft.api.boards.RedstoneBoardRegistry;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.network.RPC;
import buildcraft.core.network.RPCSide;
import buildcraft.core.utils.NBTUtils;
public class ContainerRedstoneBoard extends BuildCraftContainer {
private EntityPlayer player;
private RedstoneBoardNBT<?> board;
private IBoardParameter[] params;
public ContainerRedstoneBoard(EntityPlayer iPlayer, int x, int y, int z) {
super(iPlayer.inventory.getSizeInventory());
player = iPlayer;
NBTTagCompound boardNBT = NBTUtils.getItemData(player.getHeldItem());
board = RedstoneBoardRegistry.instance.getRedstoneBoard(boardNBT);
params = board.getParameters(boardNBT);
for (int sy = 0; sy < 3; sy++) {
for (int sx = 0; sx < 9; sx++) {
addSlotToContainer(new Slot(player.inventory, sx + sy * 9 + 9, 8 + sx * 18, 140 + sy * 18));
}
}
for (int sx = 0; sx < 9; sx++) {
addSlotToContainer(new Slot(player.inventory, sx, 8 + sx * 18, 198));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return true;
}
@RPC(RPCSide.SERVER)
public void setParameterStack(int position, ItemStack stack) {
NBTTagCompound boardNBT = NBTUtils.getItemData(player.getHeldItem());
((IBoardParameterStack) params[position]).setStack(stack);
board.setParameters(NBTUtils.getItemData(player.getHeldItem()), params);
}
}

View file

@ -1,109 +0,0 @@
/**
* 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.silicon.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import buildcraft.api.boards.IBoardParameter;
import buildcraft.api.boards.IBoardParameterStack;
import buildcraft.api.boards.RedstoneBoardNBT;
import buildcraft.api.boards.RedstoneBoardRegistry;
import buildcraft.core.DefaultProps;
import buildcraft.core.gui.AdvancedSlot;
import buildcraft.core.gui.GuiAdvancedInterface;
import buildcraft.core.gui.ItemSlot;
import buildcraft.core.network.RPCHandler;
import buildcraft.core.utils.NBTUtils;
public class GuiRedstoneBoard extends GuiAdvancedInterface {
private static final ResourceLocation TEXTURE = new ResourceLocation(
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/generic_ui.png");
private World world;
private int x, y, z;
private RedstoneBoardNBT<?> board;
private IBoardParameter[] params;
public GuiRedstoneBoard(EntityPlayer player, int ix, int iy, int iz) {
super(new ContainerRedstoneBoard(player, ix, iy, iz), player.inventory, TEXTURE);
x = ix;
y = iy;
z = iz;
xSize = 175;
ySize = 222;
world = player.worldObj;
NBTTagCompound boardNBT = NBTUtils.getItemData(player.getHeldItem());
board = RedstoneBoardRegistry.instance.getRedstoneBoard(boardNBT);
params = board.getParameters(boardNBT);
for (int i = 0; i < params.length; ++i) {
ItemSlot s = new ItemSlot(this, 10, 10 + i * 20);
slots.add(s);
s.drawBackround = true;
s.stack = ((IBoardParameterStack) params[i]).getStack();
}
}
@Override
public void initGui() {
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
drawBackgroundSlots();
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
drawTooltipForSlotAt(par1, par2);
}
@Override
protected void mouseClicked(int i, int j, int k) {
super.mouseClicked(i, j, k);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
int position = getSlotIndexAtLocation(i - cornerX, j - cornerY);
AdvancedSlot slot = null;
if (position < 0) {
return;
}
slot = slots.get(position);
if (slot instanceof ItemSlot) {
ItemStack stackCopy = mc.thePlayer.inventory.getItemStack().copy();
stackCopy.stackSize = 1;
((ItemSlot) slot).stack = stackCopy;
RPCHandler.rpcServer(container, "setParameterStack", position, stackCopy);
}
}
}