Added Iron Kinesis Pipe

The Iron Kinesis Pipe allows you select its throughput limiter via
Wrench or Gate Action.

The possible values are: 2, 4, 8, 16, 32 , 64, and 128 MJ/t
This commit is contained in:
CovertJaguar 2013-09-25 18:16:59 -07:00
parent e3fab2896d
commit 68b5c5267d
26 changed files with 120 additions and 46 deletions

View file

@ -18,8 +18,8 @@
<property name="mcpsrc.dir" value="${mcp.dir}/src"/>
<property name="mc.version" value="1.6.2"/>
<property name="forge.version" value="9.10.1.856"/>
<property name="mc.version" value="1.6.4"/>
<property name="forge.version" value="9.11.0.891"/>
<!-- <property name="project.version" value="0.0.0"/>-->
<property name="buildcraft.name" value="buildcraft"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

View file

@ -1,5 +1,7 @@
# Master language file
chat.pipe.power.iron.mode=Switched to %d MJ/t limit
gate.pipe.empty=Pipe Empty
gate.pipe.containsItems=Items Traversing
gate.pipe.containsFluids=Fluid Traversing
@ -83,6 +85,7 @@ item.PipePowerWood=Wooden Kinesis Pipe
item.PipePowerCobblestone=Cobblestone Kinesis Pipe
item.PipePowerStone=Stone Kinesis Pipe
item.PipePowerQuartz=Quartz Kinesis Pipe
item.PipePowerIron=Iron Kinesis Pipe
item.PipePowerGold=Golden Kinesis Pipe
item.PipePowerDiamond=Diamond Kinesis Pipe
item.PipeItemsStripes=Stripes Transport Pipe
@ -142,4 +145,6 @@ tip.PipeItemsSandstone=Only connects to other pipes
tip.PipeItemsStone=Basic pipe, medium drag\nWon't connect to Cobblestone or Quartz
tip.PipeItemsVoid=Destroys items
tip.PipeItemsWood=Extraction pipe
tip.PipePowerWood=Power Input Pipe
tip.PipePowerIron=Selectable Limiter Pipe
tip.PipeStructureCobblestone=Support pipe

View file

@ -65,6 +65,8 @@ import buildcraft.transport.pipes.PipeItemsWood;
import buildcraft.transport.pipes.PipePowerCobblestone;
import buildcraft.transport.pipes.PipePowerDiamond;
import buildcraft.transport.pipes.PipePowerGold;
import buildcraft.transport.pipes.PipePowerIron;
import buildcraft.transport.pipes.PipePowerIron.PowerMode;
import buildcraft.transport.pipes.PipePowerQuartz;
import buildcraft.transport.pipes.PipePowerStone;
import buildcraft.transport.pipes.PipePowerWood;
@ -72,21 +74,18 @@ import buildcraft.transport.pipes.PipeStructureCobblestone;
import buildcraft.transport.triggers.ActionEnergyPulser;
import buildcraft.transport.triggers.ActionPipeColor;
import buildcraft.transport.triggers.ActionPipeDirection;
import buildcraft.transport.triggers.ActionPowerLimiter;
import buildcraft.transport.triggers.ActionSignalOutput;
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
import buildcraft.transport.triggers.TriggerFilteredBufferInventoryLevel;
import buildcraft.transport.triggers.TriggerPipeContents;
import buildcraft.transport.triggers.TriggerPipeContents.Kind;
import buildcraft.transport.triggers.TriggerPipeSignal;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.primitives.Ints;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
@ -94,8 +93,6 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
@ -143,6 +140,7 @@ public class BuildCraftTransport {
public static Item pipePowerCobblestone;
public static Item pipePowerStone;
public static Item pipePowerQuartz;
public static Item pipePowerIron;
public static Item pipePowerGold;
public static Item pipePowerDiamond;
public static ItemFacade facadeItem;
@ -176,6 +174,7 @@ public class BuildCraftTransport {
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse(DefaultProps.ACTION_SINGLE_ENERGY_PULSE);
public static BCAction[] actionPipeColor = new BCAction[16];
public static BCAction[] actionPipeDirection = new BCAction[16];
public static BCAction[] actionPowerLimiter = new BCAction[7];
@Instance("BuildCraft|Transport")
public static BuildCraftTransport instance;
public IIconProvider pipeIconProvider = new PipeIconProvider();
@ -299,12 +298,13 @@ public class BuildCraftTransport {
pipeFluidsSandstone = buildPipe(DefaultProps.PIPE_LIQUIDS_SANDSTONE_ID, PipeFluidsSandstone.class, "Sandstone Waterproof Pipe", pipeWaterproof, pipeItemsSandstone);
pipeFluidsVoid = buildPipe(DefaultProps.PIPE_LIQUIDS_VOID_ID, PipeFluidsVoid.class, "Void Waterproof Pipe", pipeWaterproof, pipeItemsVoid);
pipePowerWood = buildPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Conductive Pipe", Item.redstone, pipeItemsWood);
pipePowerCobblestone = buildPipe(DefaultProps.PIPE_POWER_COBBLESTONE_ID, PipePowerCobblestone.class, "Cobblestone Conductive Pipe", Item.redstone, pipeItemsCobblestone);
pipePowerStone = buildPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Conductive Pipe", Item.redstone, pipeItemsStone);
pipePowerQuartz = buildPipe(DefaultProps.PIPE_POWER_QUARTZ_ID, PipePowerQuartz.class, "Quartz Conductive Pipe", Item.redstone, pipeItemsQuartz);
pipePowerGold = buildPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Conductive Pipe", Item.redstone, pipeItemsGold);
pipePowerDiamond = buildPipe(DefaultProps.PIPE_POWER_DIAMOND_ID, PipePowerDiamond.class, "Diamond Conductive Pipe", Item.redstone, pipeItemsDiamond);
pipePowerWood = buildPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Kinesis Pipe", Item.redstone, pipeItemsWood);
pipePowerCobblestone = buildPipe(DefaultProps.PIPE_POWER_COBBLESTONE_ID, PipePowerCobblestone.class, "Cobblestone Kinesis Pipe", Item.redstone, pipeItemsCobblestone);
pipePowerStone = buildPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Kinesis Pipe", Item.redstone, pipeItemsStone);
pipePowerQuartz = buildPipe(DefaultProps.PIPE_POWER_QUARTZ_ID, PipePowerQuartz.class, "Quartz Kinesis Pipe", Item.redstone, pipeItemsQuartz);
pipePowerIron = buildPipe(DefaultProps.PIPE_POWER_IRON_ID, PipePowerIron.class, "Iron Kinesis Pipe", Item.redstone, pipeItemsIron);
pipePowerGold = buildPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Kinesis Pipe", Item.redstone, pipeItemsGold);
pipePowerDiamond = buildPipe(DefaultProps.PIPE_POWER_DIAMOND_ID, PipePowerDiamond.class, "Diamond Kinesis Pipe", Item.redstone, pipeItemsDiamond);
pipeStructureCobblestone = buildPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone);
@ -418,6 +418,10 @@ public class BuildCraftTransport {
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
actionPipeDirection[direction.ordinal()] = new ActionPipeDirection(-1, direction);
}
for (PowerMode limit : PowerMode.VALUES) {
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(-1, limit);
}
}
public void loadRecipes() {

View file

@ -132,12 +132,12 @@ public enum EnumColor {
}
public EnumColor getNext() {
EnumColor next = VALUES[(ordinal() + 1) % (VALUES.length - 1)];
EnumColor next = VALUES[(ordinal() + 1) % VALUES.length];
return next;
}
public EnumColor getPrevious() {
EnumColor previous = VALUES[(ordinal() + VALUES.length - 2) % (VALUES.length - 1)];
EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length];
return previous;
}

View file

@ -64,6 +64,22 @@ public class Localization {
return mappings.getProperty(key, defaultMappings.getProperty(key, key));
}
public static synchronized boolean hasKey(String key) {
if (getCurrentLanguage() == null) {
return false;
}
if (!getCurrentLanguage().equals(loadedLanguage)) {
defaultMappings.clear();
mappings.clear();
for (modInfo mInfo : mods) {
load(mInfo.modName, mInfo.defaultLanguage);
}
loadedLanguage = getCurrentLanguage();
}
return mappings.getProperty(key, defaultMappings.getProperty(key)) != null;
}
private static void load(String path, String default_language) {
InputStream langStream = null;

View file

@ -125,12 +125,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
super.addInformation(stack, player, list, advanced);
Class<? extends Pipe> pipe = BlockGenericPipe.pipes.get(itemID);
String toolTip = PipeToolTipManager.getToolTip(pipe);
if (toolTip != null) {
String[] tips = toolTip.split("\\n");
for (String tip : tips) {
list.add(tip);
}
}
List<String> toolTip = PipeToolTipManager.getToolTip(pipe);
list.addAll(toolTip);
}
}

View file

@ -91,6 +91,14 @@ public class PipeIconProvider implements IIconProvider {
PipePowerCobblestone("pipePowerCobblestone"),
PipePowerWood_Standard("pipePowerWood_standard"),
//
PipePowerIronM2("pipePowerIronM2"),
PipePowerIronM4("pipePowerIronM4"),
PipePowerIronM8("pipePowerIronM8"),
PipePowerIronM16("pipePowerIronM16"),
PipePowerIronM32("pipePowerIronM32"),
PipePowerIronM64("pipePowerIronM64"),
PipePowerIronM128("pipePowerIronM128"),
//
Power_Normal("texture_cyan"),
Power_Overload("texture_red_lit"),
Stripes("pipeStripes"),
@ -101,11 +109,11 @@ public class PipeIconProvider implements IIconProvider {
private final String iconTagColorBlind;
private Icon icon;
private TYPE(String iconTag, String IconTagColorBlind){
private TYPE(String iconTag, String IconTagColorBlind) {
this.iconTag = iconTag;
this.iconTagColorBlind = IconTagColorBlind;
}
private TYPE(String iconTag) {
this(iconTag, iconTag);
}

View file

@ -8,10 +8,13 @@
*/
package buildcraft.transport;
import buildcraft.core.utils.StringUtils;
import buildcraft.core.utils.Localization;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -33,10 +36,19 @@ public class PipeToolTipManager {
toolTips.put(pipe, toolTip);
}
public static String getToolTip(Class<? extends Pipe> pipe) {
public static List<String> getToolTip(Class<? extends Pipe> pipe) {
List<String> tips = new ArrayList<String>();
String tipTag = "tip." + pipe.getSimpleName();
if (Localization.hasKey(tipTag)) {
String localized = Localization.get(tipTag);
if (localized != null) {
String[] lines = localized.split("\\n");
tips.addAll(Arrays.asList(lines));
}
}
String tip = toolTips.get(pipe);
if (tip != null)
return tip;
return StringUtils.localize("tip." + pipe.getSimpleName());
tips.add(tip);
return tips;
}
}

View file

@ -28,6 +28,7 @@ import buildcraft.transport.network.PacketPowerUpdate;
import buildcraft.transport.pipes.PipePowerCobblestone;
import buildcraft.transport.pipes.PipePowerDiamond;
import buildcraft.transport.pipes.PipePowerGold;
import buildcraft.transport.pipes.PipePowerIron;
import buildcraft.transport.pipes.PipePowerQuartz;
import buildcraft.transport.pipes.PipePowerStone;
import buildcraft.transport.pipes.PipePowerWood;
@ -44,6 +45,7 @@ public class PipeTransportPower extends PipeTransport {
powerCapacities.put(PipePowerStone.class, 16);
powerCapacities.put(PipePowerWood.class, 32);
powerCapacities.put(PipePowerQuartz.class, 64);
powerCapacities.put(PipePowerIron.class, 128);
powerCapacities.put(PipePowerGold.class, 256);
powerCapacities.put(PipePowerDiamond.class, 1024);
}
@ -325,11 +327,17 @@ public class PipeTransportPower extends PipeTransport {
if (ret >= 0)
return ret;
}
internalNextPower[from.ordinal()] += val;
int side = from.ordinal();
if (internalNextPower[side] > maxPower)
return 0;
if (internalNextPower[from.ordinal()] > maxPower) {
val -= internalNextPower[from.ordinal()] - maxPower;
internalNextPower[from.ordinal()] = maxPower;
internalNextPower[side] += val;
if (internalNextPower[side] > maxPower) {
val -= internalNextPower[side] - maxPower;
internalNextPower[side] = maxPower;
if (val < 0)
val = 0;
}
return val;
}

View file

@ -51,6 +51,7 @@ public class TransportProxyClient extends TransportProxy {
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerCobblestone.itemID, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerStone.itemID, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerQuartz.itemID, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerIron.itemID, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerGold.itemID, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerDiamond.itemID, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeStructureCobblestone.itemID, pipeItemRenderer);

View file

@ -9,16 +9,19 @@ package buildcraft.transport.pipes;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.gates.IAction;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.utils.StringUtils;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportPower;
import buildcraft.transport.triggers.ActionPowerLimiter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.LinkedList;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.ChatMessageComponent;
import net.minecraftforge.common.ForgeDirection;
public class PipePowerIron extends Pipe<PipeTransportPower> {
@ -27,19 +30,19 @@ public class PipePowerIron extends Pipe<PipeTransportPower> {
M2(2), M4(4), M8(8), M16(16), M32(32), M64(64), M128(128);
public static final PowerMode[] VALUES = values();
private final int maxPower;
public final int maxPower;
private PowerMode(int max) {
this.maxPower = max;
}
public PowerMode getNext() {
PowerMode next = VALUES[(ordinal() + 1) % (VALUES.length - 1)];
PowerMode next = VALUES[(ordinal() + 1) % VALUES.length];
return next;
}
public PowerMode getPrevious() {
PowerMode previous = VALUES[(ordinal() + VALUES.length - 2) % (VALUES.length - 1)];
PowerMode previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length];
return previous;
}
@ -72,7 +75,8 @@ public class PipePowerIron extends Pipe<PipeTransportPower> {
} else {
setMode(getMode().getNext());
}
player.addChatMessage(String.format(StringUtils.localize("chat.pipe.power.iron.mode"), getMode().maxPower));
if (getWorld().isRemote)
player.addChatMessage(String.format(StringUtils.localize("chat.pipe.power.iron.mode"), getMode().maxPower));
((IToolWrench) equipped).wrenchUsed(player, container.xCoord, container.yCoord, container.zCoord);
return true;
@ -104,4 +108,25 @@ public class PipePowerIron extends Pipe<PipeTransportPower> {
public IIconProvider getIconProvider() {
return BuildCraftTransport.instance.pipeIconProvider;
}
@Override
protected void actionsActivated(Map<IAction, Boolean> actions) {
super.actionsActivated(actions);
for (Map.Entry<IAction, Boolean> action : actions.entrySet()) {
if (action.getKey() instanceof ActionPowerLimiter && action.getValue() == Boolean.TRUE) {
setMode(((ActionPowerLimiter) action.getKey()).limit);
break;
}
}
}
@Override
public LinkedList<IAction> getActions() {
LinkedList<IAction> action = super.getActions();
for (PowerMode mode : PowerMode.VALUES) {
action.add(BuildCraftTransport.actionPowerLimiter[mode.ordinal()]);
}
return action;
}
}

View file

@ -8,25 +8,25 @@
package buildcraft.transport.triggers;
import buildcraft.core.triggers.BCAction;
import buildcraft.transport.pipes.PipePowerIron.PowerMode;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
public class ActionPipeDirection extends BCAction {
public class ActionPowerLimiter extends BCAction {
private Icon icon;
public final ForgeDirection direction;
public final PowerMode limit;
public ActionPipeDirection(int id, ForgeDirection direction) {
super(id, "buildcraft.pipe.dir." + direction.name().toLowerCase(Locale.ENGLISH));
public ActionPowerLimiter(int id, PowerMode limit) {
super(id, "buildcraft.power.limiter." + limit.name().toLowerCase(Locale.ENGLISH));
this.direction = direction;
this.limit = limit;
}
@Override
public String getDescription() {
return direction.name().substring(0, 1) + direction.name().substring(1).toLowerCase(Locale.ENGLISH) + " Pipe Direction";
return limit.maxPower + " MJ/t Limit";
}
@Override
@ -36,6 +36,6 @@ public class ActionPipeDirection extends BCAction {
@Override
public void registerIcons(IconRegister iconRegister) {
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_dir_" + direction.name().toLowerCase(Locale.ENGLISH));
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_limiter_" + limit.name().toLowerCase(Locale.ENGLISH));
}
}