Add Lapis Pipe Actions
Icons provided by tommy__123__, many thanks!
After Width: | Height: | Size: 3 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
|
@ -20,6 +20,7 @@ import buildcraft.core.Version;
|
|||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.triggers.BCAction;
|
||||
import buildcraft.core.triggers.BCTrigger;
|
||||
import buildcraft.core.utils.EnumColor;
|
||||
import buildcraft.transport.BlockFilteredBuffer;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.GateIconProvider;
|
||||
|
@ -67,6 +68,7 @@ import buildcraft.transport.pipes.PipePowerStone;
|
|||
import buildcraft.transport.pipes.PipePowerWood;
|
||||
import buildcraft.transport.pipes.PipeStructureCobblestone;
|
||||
import buildcraft.transport.triggers.ActionEnergyPulser;
|
||||
import buildcraft.transport.triggers.ActionPipeColor;
|
||||
import buildcraft.transport.triggers.ActionSignalOutput;
|
||||
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
|
||||
import buildcraft.transport.triggers.TriggerFilteredBufferInventoryLevel;
|
||||
|
@ -170,6 +172,7 @@ public class BuildCraftTransport {
|
|||
public static BCAction actionYellowSignal = new ActionSignalOutput(DefaultProps.ACTION_YELLOW_SIGNAL, IPipe.WireColor.Yellow);
|
||||
public static BCAction actionEnergyPulser = new ActionEnergyPulser(DefaultProps.ACTION_ENERGY_PULSER);
|
||||
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse(DefaultProps.ACTION_SINGLE_ENERGY_PULSE);
|
||||
public static BCAction[] actionPipeColor = new BCAction[16];
|
||||
@Instance("BuildCraft|Transport")
|
||||
public static BuildCraftTransport instance;
|
||||
public IIconProvider pipeIconProvider = new PipeIconProvider();
|
||||
|
@ -403,6 +406,10 @@ public class BuildCraftTransport {
|
|||
@PostInit
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
ItemFacade.initialize();
|
||||
|
||||
for(EnumColor color : EnumColor.VALUES){
|
||||
actionPipeColor[color.ordinal()] = new ActionPipeColor(-1, color);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadRecipes() {
|
||||
|
|
|
@ -12,25 +12,17 @@ import buildcraft.api.core.IIconProvider;
|
|||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.TriggerParameter;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.core.IDropControlInventory;
|
||||
import buildcraft.core.network.TilePacketWrapper;
|
||||
import buildcraft.core.triggers.ActionRedstoneOutput;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.Gate.GateConditional;
|
||||
import buildcraft.transport.triggers.ActionSignalOutput;
|
||||
import com.google.common.collect.HashMultiset;
|
||||
import com.google.common.collect.Multiset;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
|
|
@ -37,6 +37,7 @@ public class TransportProxyClient extends TransportProxy {
|
|||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDiamond.itemID, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsObsidian.itemID, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmerald.itemID, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsLapis.itemID, pipeItemRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsWood.itemID, pipeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsCobblestone.itemID, pipeItemRenderer);
|
||||
|
|
|
@ -10,6 +10,7 @@ package buildcraft.transport.pipes;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.api.transport.IPipedItem;
|
||||
import buildcraft.core.utils.EnumColor;
|
||||
|
@ -20,9 +21,13 @@ import buildcraft.transport.IPipeTransportItemsHook;
|
|||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeTransportItems;
|
||||
import buildcraft.transport.triggers.ActionPipeColor;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -65,9 +70,11 @@ public class PipeItemsLapis extends Pipe implements IItemTravelingHook, IPipeTra
|
|||
}
|
||||
|
||||
public void setColor(EnumColor color) {
|
||||
container.worldObj.setBlockMetadataWithNotify(container.xCoord, container.yCoord, container.zCoord, color.ordinal(), 3);
|
||||
container.scheduleRenderUpdate();
|
||||
container.markBlockForUpdate();
|
||||
if (color.ordinal() != container.getBlockMetadata()) {
|
||||
container.worldObj.setBlockMetadataWithNotify(container.xCoord, container.yCoord, container.zCoord, color.ordinal(), 3);
|
||||
container.scheduleRenderUpdate();
|
||||
container.markBlockForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,4 +109,24 @@ public class PipeItemsLapis extends Pipe implements IItemTravelingHook, IPipeTra
|
|||
@Override
|
||||
public void entityEntered(IPipedItem item, ForgeDirection orientation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionsActivated(Map<IAction, Boolean> actions) {
|
||||
super.actionsActivated(actions);
|
||||
|
||||
for (Entry<IAction, Boolean> action : actions.entrySet()) {
|
||||
if (action.getKey() instanceof ActionPipeColor && action.getValue() != null && action.getValue()) {
|
||||
setColor(((ActionPipeColor) action.getKey()).color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<IAction> getActions() {
|
||||
LinkedList<IAction> result = super.getActions();
|
||||
result.addAll(Arrays.asList(BuildCraftTransport.actionPipeColor));
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
41
common/buildcraft/transport/triggers/ActionPipeColor.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011 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.triggers;
|
||||
|
||||
import buildcraft.core.triggers.BCAction;
|
||||
import buildcraft.core.utils.EnumColor;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
public class ActionPipeColor extends BCAction {
|
||||
|
||||
private Icon icon;
|
||||
public final EnumColor color;
|
||||
|
||||
public ActionPipeColor(int id, EnumColor color) {
|
||||
super(id, "buildcraft.pipe." + color.getTag());
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return color.getName() + " Pipe Color";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
icon = iconRegister.registerIcon("buildcraft:triggers/color_" + color.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|