made progress with boards and parameters, #1732

This commit is contained in:
SpaceToad 2014-05-30 09:04:00 +02:00
parent 7b20cab4be
commit e99f0a3c4b
6 changed files with 52 additions and 0 deletions

View file

@ -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 {
}

View file

@ -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);
}

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

View file

@ -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);
}
}
}

View file

@ -51,6 +51,7 @@ public class ImplRedstoneBoardRegistry extends RedstoneBoardRegistry {
if (accumulatedSearch > value) {
nbt.setString("id", f.boardNBT.getID());
f.boardNBT.createRandomBoard(nbt, rand);
return;
}
}