started work on redstone boards, #1732

This commit is contained in:
SpaceToad 2014-05-26 09:34:28 +02:00
parent e5e8e4da4b
commit 34d285a448
18 changed files with 95 additions and 163 deletions

View file

@ -132,6 +132,7 @@ item.redstone_diamond_chipset.name=Diamond Chipset
item.redstone_pulsating_chipset.name=Pulsating Chipset
item.redstone_quartz_chipset.name=Quartz Chipset
item.redstone_comp_chipset.name=Redstone Comp Chipset
item.redstone_board.name=Redstone Board
item.blueprintItem.name=Blueprint
item.blueprint.unnamed=<unnamed>
item.blueprint.author=by

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

View file

@ -71,7 +71,6 @@ import buildcraft.core.CoreIconProvider;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.ItemRobot;
import buildcraft.core.ItemSpring;
import buildcraft.core.ItemWrench;
import buildcraft.core.SpringPopulate;
@ -132,10 +131,6 @@ public class BuildCraftCore extends BuildCraftMod {
public static Item goldGearItem;
public static Item diamondGearItem;
public static Item wrenchItem;
public static Item redstoneCrystal;
public static Item robotBaseItem;
public static Item robotBuilderItem;
public static Item robotPickerItem;
@SideOnly(Side.CLIENT)
public static IIcon redLaserTexture;
@SideOnly(Side.CLIENT)
@ -290,21 +285,6 @@ public class BuildCraftCore extends BuildCraftMod {
CoreProxy.proxy.registerItem(diamondGearItem);
OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));
if (!BuildCraftCore.NONRELEASED_BLOCKS) {
redstoneCrystal = (new ItemBuildCraft()).setUnlocalizedName("redstoneCrystal");
CoreProxy.proxy.registerItem(redstoneCrystal);
OreDictionary.registerOre("redstoneCrystal", new ItemStack(redstoneCrystal));
}
robotBaseItem = new ItemRobot(EntityRobot.class).setUnlocalizedName("robotBase");
CoreProxy.proxy.registerItem(robotBaseItem);
robotPickerItem = new ItemRobot(EntityRobotPicker.class).setUnlocalizedName("robotPicker");
CoreProxy.proxy.registerItem(robotPickerItem);
robotBuilderItem = new ItemRobot(EntityRobotBuilder.class).setUnlocalizedName("robotBuilder");
CoreProxy.proxy.registerItem(robotBuilderItem);
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
} finally {

View file

@ -14,6 +14,7 @@ import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
@ -22,18 +23,26 @@ import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraftforge.oredict.OreDictionary;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.PipeWire;
import buildcraft.builders.schematics.SchematicRotateMeta;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.ItemRobot;
import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.robots.EntityRobot;
import buildcraft.core.robots.EntityRobotBuilder;
import buildcraft.core.robots.EntityRobotPicker;
import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable;
import buildcraft.silicon.GuiHandler;
import buildcraft.silicon.ItemLaserTable;
import buildcraft.silicon.ItemRedstoneBoard;
import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.silicon.SiliconProxy;
@ -56,11 +65,17 @@ import buildcraft.transport.gates.ItemGate;
public class BuildCraftSilicon extends BuildCraftMod {
public static ItemRedstoneChipset redstoneChipset;
public static ItemRedstoneBoard redstoneBoard;
public static BlockLaser laserBlock;
public static BlockLaserTable assemblyTableBlock;
@Mod.Instance("BuildCraft|Silicon")
public static BuildCraftSilicon instance;
public static Item redstoneCrystal;
public static Item robotBaseItem;
public static Item robotBuilderItem;
public static Item robotPickerItem;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Silicon");
@ -78,6 +93,23 @@ public class BuildCraftSilicon extends BuildCraftMod {
redstoneChipset.setUnlocalizedName("redstoneChipset");
CoreProxy.proxy.registerItem(redstoneChipset);
redstoneChipset.registerItemStacks();
redstoneBoard = new ItemRedstoneBoard();
redstoneBoard.setUnlocalizedName("redstone_board");
CoreProxy.proxy.registerItem(redstoneBoard);
redstoneCrystal = (new ItemBuildCraft()).setUnlocalizedName("redstoneCrystal");
CoreProxy.proxy.registerItem(redstoneCrystal);
OreDictionary.registerOre("redstoneCrystal", new ItemStack(redstoneCrystal));
robotBaseItem = new ItemRobot(EntityRobot.class).setUnlocalizedName("robotBase");
CoreProxy.proxy.registerItem(robotBaseItem);
robotPickerItem = new ItemRobot(EntityRobotPicker.class).setUnlocalizedName("robotPicker");
CoreProxy.proxy.registerItem(robotPickerItem);
robotBuilderItem = new ItemRobot(EntityRobotBuilder.class).setUnlocalizedName("robotBuilder");
CoreProxy.proxy.registerItem(robotBuilderItem);
}
@Mod.EventHandler

View file

@ -96,7 +96,6 @@ import buildcraft.transport.pipes.PipeItemsWood;
import buildcraft.transport.pipes.PipePowerCobblestone;
import buildcraft.transport.pipes.PipePowerDiamond;
import buildcraft.transport.pipes.PipePowerGold;
import buildcraft.transport.pipes.PipePowerHeat;
import buildcraft.transport.pipes.PipePowerIron;
import buildcraft.transport.pipes.PipePowerIron.PowerMode;
import buildcraft.transport.pipes.PipePowerQuartz;
@ -359,10 +358,6 @@ public class BuildCraftTransport extends BuildCraftMod {
pipePowerGold = buildPipe(PipePowerGold.class, "Golden Kinesis Pipe", CreativeTabBuildCraft.PIPES, Items.redstone, pipeItemsGold);
pipePowerDiamond = buildPipe(PipePowerDiamond.class, "Diamond Kinesis Pipe", CreativeTabBuildCraft.PIPES, Items.redstone, pipeItemsDiamond);
if (!BuildCraftCore.NONRELEASED_BLOCKS) {
pipePowerHeat = buildPipe(PipePowerHeat.class, "Heat Kinesis Pipe", CreativeTabBuildCraft.PIPES, Blocks.furnace, pipeItemsDiamond);
}
pipeStructureCobblestone = buildPipe(PipeStructureCobblestone.class, "Cobblestone Structure Pipe", CreativeTabBuildCraft.PIPES, Blocks.gravel, pipeItemsCobblestone);
pipeWire = new ItemPipeWire();

View file

@ -30,6 +30,7 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraftforge.client.MinecraftForgeClient;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftSilicon;
import buildcraft.core.EntityBlock;
import buildcraft.core.LaserKind;
import buildcraft.core.render.RenderEntityBlock;
@ -99,9 +100,10 @@ public class CoreProxyClient extends CoreProxy {
RenderingRegistry.registerBlockHandler(BuildCraftCore.legacyPipeModel, new RenderingEntityBlocks());
RenderingRegistry.registerBlockHandler(new RenderingMarkers());
MinecraftForgeClient.registerItemRenderer(BuildCraftCore.robotBaseItem, new RenderRobot());
MinecraftForgeClient.registerItemRenderer(BuildCraftCore.robotBuilderItem, new RenderRobot());
MinecraftForgeClient.registerItemRenderer(BuildCraftCore.robotPickerItem, new RenderRobot());
// TODO: Move these to a Silicon proxy renderer
MinecraftForgeClient.registerItemRenderer(BuildCraftSilicon.robotBaseItem, new RenderRobot());
MinecraftForgeClient.registerItemRenderer(BuildCraftSilicon.robotBuilderItem, new RenderRobot());
MinecraftForgeClient.registerItemRenderer(BuildCraftSilicon.robotPickerItem, new RenderRobot());
}
@Override

View file

@ -21,7 +21,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftSilicon;
import buildcraft.core.DefaultProps;
import buildcraft.core.EntityLaser;
import buildcraft.core.robots.EntityRobot;
@ -108,11 +108,11 @@ public class RenderRobot extends Render implements IItemRenderer {
// FIXME: Texture localisation should be factorized between items and
// entities.
if (item.getItem() == BuildCraftCore.robotBaseItem) {
if (item.getItem() == BuildCraftSilicon.robotBaseItem) {
RenderManager.instance.renderEngine.bindTexture(TEXTURE_BASE);
} else if (item.getItem() == BuildCraftCore.robotBuilderItem) {
} else if (item.getItem() == BuildCraftSilicon.robotBuilderItem) {
RenderManager.instance.renderEngine.bindTexture(TEXTURE_BUILDER);
} else if (item.getItem() == BuildCraftCore.robotPickerItem) {
} else if (item.getItem() == BuildCraftSilicon.robotPickerItem) {
RenderManager.instance.renderEngine.bindTexture(TEXTURE_PICKER);
}

View file

@ -0,0 +1,53 @@
/**
* 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;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.utils.NBTUtils;
public class ItemRedstoneBoard extends ItemBuildCraft {
public IIcon cleanBoard;
public IIcon usedBoard;
public ItemRedstoneBoard() {
super();
}
@Override
public int getItemStackLimit(ItemStack stack) {
return NBTUtils.getItemData(stack).hasKey("kind") ? 1 : 16;
}
@Override
public IIcon getIconIndex(ItemStack stack) {
if (!NBTUtils.getItemData(stack).hasKey("kind")) {
itemIcon = cleanBoard;
} else {
itemIcon = usedBoard;
}
return itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
cleanBoard = par1IconRegister.registerIcon("buildcraft:board_clean");
usedBoard = par1IconRegister.registerIcon("buildcraft:board_used");
}
}

View file

@ -33,7 +33,6 @@ import buildcraft.transport.network.PacketPowerUpdate;
import buildcraft.transport.pipes.PipePowerCobblestone;
import buildcraft.transport.pipes.PipePowerDiamond;
import buildcraft.transport.pipes.PipePowerGold;
import buildcraft.transport.pipes.PipePowerHeat;
import buildcraft.transport.pipes.PipePowerIron;
import buildcraft.transport.pipes.PipePowerQuartz;
import buildcraft.transport.pipes.PipePowerStone;
@ -517,6 +516,5 @@ public class PipeTransportPower extends PipeTransport {
powerCapacities.put(PipePowerIron.class, 128);
powerCapacities.put(PipePowerGold.class, 256);
powerCapacities.put(PipePowerDiamond.class, 1024);
powerCapacities.put(PipePowerHeat.class, 1024);
}
}

View file

@ -1,129 +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.transport.pipes;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportPower;
public class PipePowerHeat extends Pipe<PipeTransportPower> {
int zeroAcc = 0;
double powerLevel = 0;
SafeTimeTracker scanTracker = new SafeTimeTracker(40, 5);
public PipePowerHeat(Item item) {
super(new PipeTransportPower(), item);
transport.initFromPipe(getClass());
}
@Override
@SideOnly(Side.CLIENT)
public IIconProvider getIconProvider() {
return BuildCraftTransport.instance.pipeIconProvider;
}
public int getHeatLevel () {
if (powerLevel == 0) {
return 0;
} else if (powerLevel >= 1000) {
return 8;
} else {
return 1 + (int) (powerLevel / 1000F * 7F);
}
}
@Override
public int getIconIndex(ForgeDirection direction) {
if (container == null) {
return PipeIconProvider.TYPE.PipePowerHeat0.ordinal();
} else {
return PipeIconProvider.TYPE.PipePowerHeat0.ordinal()
+ container.getWorld().getBlockMetadata(container.xCoord,
container.yCoord, container.zCoord);
}
}
@Override
public void updateEntity() {
super.updateEntity();
if (container.getWorld().isRemote) {
return;
}
PipeTransportPower power = transport;
power.requestEnergy(ForgeDirection.UP, 1024);
powerLevel = power.clearInstantPower ();
int meta = container.getWorld().getBlockMetadata(container.xCoord, container.yCoord, container.zCoord);
int newMeta = getHeatLevel();
if (meta != newMeta) {
container.getWorld().setBlockMetadataWithNotify(container.xCoord,
container.yCoord, container.zCoord, newMeta, 2);
container.scheduleRenderUpdate();
}
if (powerLevel >= 10 && scanTracker.markTimeIfDelay(container.getWorld())) {
int x = container.xCoord;
int y = container.yCoord;
int z = container.zCoord;
for (int xi = x - 1; xi <= x + 1; ++xi) {
for (int yi = y - 1; yi <= y + 1; ++yi) {
for (int zi = z - 1; zi <= z + 1; ++zi) {
if (container.getWorld().getBlock(xi, yi, zi) == Blocks.redstone_block) {
container.getWorld().setBlock(xi, yi, zi, Blocks.air);
for (int i = 0; i < 4; ++i) {
ItemStack stack = new ItemStack(
BuildCraftCore.redstoneCrystal);
EntityItem entityitem = new EntityItem(
container.getWorld(), xi + 0.5F,
yi + 0.5F, zi + 0.5F, stack);
entityitem.lifespan = BuildCraftCore.itemLifespan;
entityitem.delayBeforeCanPickup = 10;
float f3 = 0.05F;
entityitem.motionX = (float) (container.getWorld().rand
.nextGaussian() - 0.5F) * f3;
entityitem.motionY = (float) (container.getWorld().rand
.nextGaussian() - 0.5F) * f3;
entityitem.motionZ = (float) (container.getWorld().rand
.nextGaussian() - 0.5F) * f3;
container.getWorld()
.spawnEntityInWorld(entityitem);
}
}
}
}
}
}
}
}