From e99f0a3c4bace80a5454db2da45012cf7ac89933 Mon Sep 17 00:00:00 2001 From: SpaceToad Date: Fri, 30 May 2014 09:04:00 +0200 Subject: [PATCH] made progress with boards and parameters, #1732 --- api/buildcraft/api/boards/BoardParameter.java | 13 ++++++++ .../api/boards/IRedstoneBoardNBT.java | 8 +++++ .../assets/buildcraft/lang/en_US.lang | 1 + .../buildcraft/textures/gui/generic_ui.png | Bin 0 -> 991 bytes .../robots/boards/BoardRobotPickerNBT.java | 29 ++++++++++++++++++ .../boards/ImplRedstoneBoardRegistry.java | 1 + 6 files changed, 52 insertions(+) create mode 100755 api/buildcraft/api/boards/BoardParameter.java create mode 100755 buildcraft_resources/assets/buildcraft/textures/gui/generic_ui.png diff --git a/api/buildcraft/api/boards/BoardParameter.java b/api/buildcraft/api/boards/BoardParameter.java new file mode 100755 index 00000000..72074f86 --- /dev/null +++ b/api/buildcraft/api/boards/BoardParameter.java @@ -0,0 +1,13 @@ +/** + * 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 class BoardParameter { + +} diff --git a/api/buildcraft/api/boards/IRedstoneBoardNBT.java b/api/buildcraft/api/boards/IRedstoneBoardNBT.java index 524f2e45..666f3354 100755 --- a/api/buildcraft/api/boards/IRedstoneBoardNBT.java +++ b/api/buildcraft/api/boards/IRedstoneBoardNBT.java @@ -9,6 +9,7 @@ package buildcraft.api.boards; import java.util.List; +import java.util.Random; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -32,4 +33,11 @@ public interface IRedstoneBoardNBT { @SideOnly(Side.CLIENT) IIcon getIcon(NBTTagCompound nbt); + + BoardParameter[] getParameters(); + + void setParameters(BoardParameter[] parameters); + + void createRandomBoard(NBTTagCompound nbt, Random rand); + } diff --git a/buildcraft_resources/assets/buildcraft/lang/en_US.lang b/buildcraft_resources/assets/buildcraft/lang/en_US.lang index fbf6ce99..a6951529 100755 --- a/buildcraft_resources/assets/buildcraft/lang/en_US.lang +++ b/buildcraft_resources/assets/buildcraft/lang/en_US.lang @@ -1,6 +1,7 @@ # Master language file buildcraft.boardRobotPicker=Picker Program +buildcraft.boardDetail.oneParameter=One Parameter chat.pipe.power.iron.mode=Switched to %d MJ/t limit chat.pipe.power.energyConverter=Energy conversion: %s diff --git a/buildcraft_resources/assets/buildcraft/textures/gui/generic_ui.png b/buildcraft_resources/assets/buildcraft/textures/gui/generic_ui.png new file mode 100755 index 0000000000000000000000000000000000000000..9784b1d2ce22788f917e940f9d00be62c4ea8e80 GIT binary patch literal 991 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6&6|H(?D8gCb z5n0T@z;_6Q8AUa`8i0cAC7!;n?DtsZ*mSufwro#eU|`Piba4!+xb^mqW7lE_k%oui z&hJ!IuCI_$37B`d`Gw_|h^w==u^UZrJ>{cacYoE(w(9{Gd3bek=mpS}I{u35!-v%Revr$RsBD)b_TAz+ zEJo@4#q-RWcn=E*3O=@2cimuq1yh85gP7U98JDe&yD7W}rArnD0R{&w3C%k} z{W&b3M8S48Y~NGEnW4SGvUC*&}2* h+4q)#@+5v>_K9_4`_`ha>W#r5g`Tc{F6*2UngA8K25kTU literal 0 HcmV?d00001 diff --git a/common/buildcraft/core/robots/boards/BoardRobotPickerNBT.java b/common/buildcraft/core/robots/boards/BoardRobotPickerNBT.java index ed80a6c5..451744cd 100755 --- a/common/buildcraft/core/robots/boards/BoardRobotPickerNBT.java +++ b/common/buildcraft/core/robots/boards/BoardRobotPickerNBT.java @@ -9,6 +9,7 @@ package buildcraft.core.robots.boards; import java.util.List; +import java.util.Random; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -17,9 +18,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; +import buildcraft.api.boards.BoardParameter; import buildcraft.api.boards.IRedstoneBoardRobot; import buildcraft.api.boards.IRedstoneBoardRobotNBT; import buildcraft.core.robots.EntityRobot; +import buildcraft.core.utils.NBTUtils; import buildcraft.core.utils.StringUtils; public class BoardRobotPickerNBT implements IRedstoneBoardRobotNBT { @@ -34,6 +37,12 @@ public class BoardRobotPickerNBT implements IRedstoneBoardRobotNBT { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { list.add(StringUtils.localize("buildcraft.boardRobotPicker")); + + NBTTagCompound nbt = NBTUtils.getItemData(stack); + + if (nbt.getInteger("params") == 1) { + list.add(StringUtils.localize("buildcraft.boardDetail.oneParameter")); + } } @Override @@ -56,4 +65,24 @@ public class BoardRobotPickerNBT implements IRedstoneBoardRobotNBT { return EntityRobot.ROBOT_TRANSPORT; } + @Override + public BoardParameter[] getParameters() { + return null; + } + + @Override + public void setParameters(BoardParameter[] parameters) { + } + + @Override + public void createRandomBoard(NBTTagCompound nbt, Random rand) { + float value = rand.nextFloat(); + + if (value < 0.5) { + nbt.setInteger("params", 0); + } else { + nbt.setInteger("params", 1); + } + } + } diff --git a/common/buildcraft/silicon/boards/ImplRedstoneBoardRegistry.java b/common/buildcraft/silicon/boards/ImplRedstoneBoardRegistry.java index c74a0dec..14406eea 100755 --- a/common/buildcraft/silicon/boards/ImplRedstoneBoardRegistry.java +++ b/common/buildcraft/silicon/boards/ImplRedstoneBoardRegistry.java @@ -51,6 +51,7 @@ public class ImplRedstoneBoardRegistry extends RedstoneBoardRegistry { if (accumulatedSearch > value) { nbt.setString("id", f.boardNBT.getID()); + f.boardNBT.createRandomBoard(nbt, rand); return; } }