add base code for dual-mode Architect Table, fix robots (and add safeguard for missing AI constructors), rewrite power beam calculation, add list tooltip code
This commit is contained in:
parent
147ba92595
commit
29c90c77b9
15 changed files with 163 additions and 70 deletions
|
@ -477,6 +477,8 @@ tip.deprecated=Deprecated
|
||||||
tip.filler.excavate.on=Excavate
|
tip.filler.excavate.on=Excavate
|
||||||
tip.filler.excavate.off=Do Not Excavate
|
tip.filler.excavate.off=Do Not Excavate
|
||||||
|
|
||||||
|
tip.list.matches=Matches
|
||||||
|
|
||||||
tip.shift.PipeFluidsDiamond=GUI accepts any fluid containers
|
tip.shift.PipeFluidsDiamond=GUI accepts any fluid containers
|
||||||
tip.shift.PipeFluidsEmerald=GUI accepts any fluid container
|
tip.shift.PipeFluidsEmerald=GUI accepts any fluid container
|
||||||
tip.shift.PipeItemsClay=Prioritizes machines and chests\nover neighbouring pipes.
|
tip.shift.PipeItemsClay=Prioritizes machines and chests\nover neighbouring pipes.
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
Binary file not shown.
After Width: | Height: | Size: 139 B |
|
@ -8,16 +8,18 @@ Additions:
|
||||||
* Clay fluid pipe! The power of insertion applied to liquids. (asie)
|
* Clay fluid pipe! The power of insertion applied to liquids. (asie)
|
||||||
* Power Adapters! Connect Kinesis Pipes to non-Kinesis pipes. (asie)
|
* Power Adapters! Connect Kinesis Pipes to non-Kinesis pipes. (asie)
|
||||||
* New blueprint library GUI, now featuring a scrollbar! (asie)
|
* New blueprint library GUI, now featuring a scrollbar! (asie)
|
||||||
* New Lists - sort by type, material, or both, and other improvements! (asie)
|
* New Lists! (asie)
|
||||||
|
* Sort by type, material, or both! Precise sorting!
|
||||||
|
* See with a tooltip if an item matches the List!
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
* New power beam display algorithm (asie)
|
||||||
* Use integrated server data in singleplayer for certain tiles - back to the smoothness of 1.2.5! (asie)
|
* Use integrated server data in singleplayer for certain tiles - back to the smoothness of 1.2.5! (asie)
|
||||||
* Rewritten pipe wires - should now propagate more or less instantly. (asie)
|
* Rewritten pipe wires - should now propagate more or less instantly. (asie)
|
||||||
* Fluid pipe capacity and extraction rate now scales with the base flow multiplier. (asie)
|
* Fluid pipe capacity and extraction rate now scales with the base flow multiplier. (asie)
|
||||||
* Debugger support for fluid pipes (asie)
|
* Debugger support for fluid pipes (asie)
|
||||||
* Add events for robot interaction and removal (asie)
|
* Add events for robot interaction and removal (asie)
|
||||||
* Tweaked power beam rendering algorithm (asie)
|
|
||||||
* Rewritten robots request system (hea3ven)
|
* Rewritten robots request system (hea3ven)
|
||||||
* Changed the IRequestProvider api to be independent of robots.
|
* Changed the IRequestProvider api to be independent of robots.
|
||||||
* Delivery robots can now carry more than an item at a time.
|
* Delivery robots can now carry more than an item at a time.
|
||||||
|
|
|
@ -133,6 +133,7 @@ import buildcraft.core.list.ListMatchHandlerClass;
|
||||||
import buildcraft.core.list.ListMatchHandlerFluid;
|
import buildcraft.core.list.ListMatchHandlerFluid;
|
||||||
import buildcraft.core.list.ListMatchHandlerOreDictionary;
|
import buildcraft.core.list.ListMatchHandlerOreDictionary;
|
||||||
import buildcraft.core.list.ListRegistry;
|
import buildcraft.core.list.ListRegistry;
|
||||||
|
import buildcraft.core.list.ListTooltipHandler;
|
||||||
import buildcraft.core.network.PacketHandlerCore;
|
import buildcraft.core.network.PacketHandlerCore;
|
||||||
import buildcraft.core.properties.WorldPropertyIsDirt;
|
import buildcraft.core.properties.WorldPropertyIsDirt;
|
||||||
import buildcraft.core.properties.WorldPropertyIsFarmland;
|
import buildcraft.core.properties.WorldPropertyIsFarmland;
|
||||||
|
@ -382,6 +383,7 @@ public class BuildCraftCore extends BuildCraftMod {
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
|
MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ListTooltipHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
|
|
@ -12,18 +12,16 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.BuildCraftBuilders;
|
import buildcraft.BuildCraftBuilders;
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
|
import buildcraft.core.internal.ICustomLEDBlock;
|
||||||
import buildcraft.core.lib.block.BlockBuildCraft;
|
import buildcraft.core.lib.block.BlockBuildCraft;
|
||||||
|
|
||||||
public class BlockArchitect extends BlockBuildCraft {
|
public class BlockArchitect extends BlockBuildCraft implements ICustomLEDBlock {
|
||||||
private IIcon[] led;
|
|
||||||
|
|
||||||
public BlockArchitect() {
|
public BlockArchitect() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
setRotatable(true);
|
setRotatable(true);
|
||||||
|
@ -68,4 +66,9 @@ public class BlockArchitect extends BlockBuildCraft {
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getLEDSuffixes() {
|
||||||
|
return new String[] { "led_red", "led_mode_copy", "led_mode_edit" };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
package buildcraft.builders;
|
package buildcraft.builders;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
@ -44,20 +43,23 @@ import buildcraft.core.lib.utils.NetworkUtils;
|
||||||
import buildcraft.core.lib.utils.Utils;
|
import buildcraft.core.lib.utils.Utils;
|
||||||
|
|
||||||
public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider, ICommandReceiver, ILEDProvider {
|
public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider, ICommandReceiver, ILEDProvider {
|
||||||
|
public enum Mode {
|
||||||
|
EDIT, COPY
|
||||||
|
}
|
||||||
|
|
||||||
public String currentAuthorName = "";
|
public String currentAuthorName = "";
|
||||||
|
public Mode mode = Mode.EDIT;
|
||||||
|
|
||||||
public Box box = new Box();
|
public Box box = new Box();
|
||||||
public String name = "";
|
public String name = "";
|
||||||
public BlueprintReadConfiguration readConfiguration = new BlueprintReadConfiguration();
|
public BlueprintReadConfiguration readConfiguration = new BlueprintReadConfiguration();
|
||||||
|
|
||||||
public LinkedList<LaserData> subLasers = new LinkedList<LaserData>();
|
public ArrayList<LaserData> subLasers = new ArrayList<LaserData>();
|
||||||
|
|
||||||
public ArrayList<BlockIndex> subBlueprints = new ArrayList<BlockIndex>();
|
public ArrayList<BlockIndex> subBlueprints = new ArrayList<BlockIndex>();
|
||||||
|
|
||||||
private SimpleInventory inv = new SimpleInventory(2, "Architect", 1);
|
private SimpleInventory inv = new SimpleInventory(2, "Architect", 1);
|
||||||
|
|
||||||
private RecursiveBlueprintReader reader;
|
private RecursiveBlueprintReader reader;
|
||||||
private boolean isProcessing;
|
private boolean clientIsWorking, initialized;
|
||||||
|
|
||||||
public TileArchitect() {
|
public TileArchitect() {
|
||||||
box.kind = Kind.BLUE_STRIPES;
|
box.kind = Kind.BLUE_STRIPES;
|
||||||
|
@ -68,12 +70,11 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (reader != null) {
|
if (mode == Mode.COPY && reader != null) {
|
||||||
reader.iterate();
|
reader.iterate();
|
||||||
|
|
||||||
if (reader.isDone()) {
|
if (reader.isDone()) {
|
||||||
reader = null;
|
reader = null;
|
||||||
isProcessing = false;
|
|
||||||
sendNetworkUpdate();
|
sendNetworkUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,17 +85,25 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote && !initialized) {
|
||||||
if (!box.isInitialized()) {
|
if (!box.isInitialized()) {
|
||||||
IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord,
|
IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord,
|
||||||
yCoord, zCoord);
|
yCoord, zCoord);
|
||||||
|
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
|
mode = Mode.COPY;
|
||||||
box.initialize(a);
|
box.initialize(a);
|
||||||
a.removeFromWorld();
|
a.removeFromWorld();
|
||||||
sendNetworkUpdate();
|
sendNetworkUpdate();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
mode = Mode.EDIT;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mode = Mode.COPY;
|
||||||
}
|
}
|
||||||
|
initialized = true;
|
||||||
|
sendNetworkUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +122,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
ItemStack result = inv.decrStackSize(i, j);
|
ItemStack result = inv.decrStackSize(i, j);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
initializeComputing();
|
initializeBlueprint();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -124,7 +133,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
inv.setInventorySlotContents(i, itemstack);
|
inv.setInventorySlotContents(i, itemstack);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
initializeComputing();
|
initializeBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +167,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
|
|
||||||
inv.readFromNBT(nbt);
|
inv.readFromNBT(nbt);
|
||||||
|
|
||||||
|
mode = Mode.values()[nbt.getByte("mode")];
|
||||||
name = nbt.getString("name");
|
name = nbt.getString("name");
|
||||||
currentAuthorName = nbt.getString("lastAuthor");
|
currentAuthorName = nbt.getString("lastAuthor");
|
||||||
|
|
||||||
|
@ -186,6 +196,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
|
|
||||||
inv.writeToNBT(nbt);
|
inv.writeToNBT(nbt);
|
||||||
|
|
||||||
|
nbt.setByte("mode", (byte) mode.ordinal());
|
||||||
nbt.setString("name", name);
|
nbt.setString("name", name);
|
||||||
nbt.setString("lastAuthor", currentAuthorName);
|
nbt.setString("lastAuthor", currentAuthorName);
|
||||||
|
|
||||||
|
@ -204,29 +215,34 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
nbt.setTag("subBlueprints", subBptList);
|
nbt.setTag("subBlueprints", subBptList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean getIsWorking() {
|
||||||
|
return mode == Mode.COPY ? reader != null : false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeData(ByteBuf stream) {
|
public void writeData(ByteBuf stream) {
|
||||||
box.writeData(stream);
|
box.writeData(stream);
|
||||||
NetworkUtils.writeUTF(stream, name);
|
NetworkUtils.writeUTF(stream, name);
|
||||||
|
stream.writeBoolean(getIsWorking());
|
||||||
|
stream.writeByte(mode.ordinal());
|
||||||
|
if (mode == Mode.COPY) {
|
||||||
readConfiguration.writeData(stream);
|
readConfiguration.writeData(stream);
|
||||||
stream.writeBoolean(reader != null);
|
|
||||||
stream.writeShort(subLasers.size());
|
stream.writeShort(subLasers.size());
|
||||||
for (LaserData ld: subLasers) {
|
for (LaserData ld: subLasers) {
|
||||||
ld.writeData(stream);
|
ld.writeData(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readData(ByteBuf stream) {
|
public void readData(ByteBuf stream) {
|
||||||
box.readData(stream);
|
box.readData(stream);
|
||||||
name = NetworkUtils.readUTF(stream);
|
name = NetworkUtils.readUTF(stream);
|
||||||
readConfiguration.readData(stream);
|
clientIsWorking = stream.readBoolean();
|
||||||
boolean newIsProcessing = stream.readBoolean();
|
mode = Mode.values()[stream.readByte()];
|
||||||
if (newIsProcessing != isProcessing) {
|
|
||||||
isProcessing = newIsProcessing;
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (mode == Mode.COPY) {
|
||||||
|
readConfiguration.readData(stream);
|
||||||
int size = stream.readUnsignedShort();
|
int size = stream.readUnsignedShort();
|
||||||
subLasers.clear();
|
subLasers.clear();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
|
@ -235,18 +251,21 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
subLasers.add(ld);
|
subLasers.add(ld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeComputing() {
|
private void initializeBlueprint() {
|
||||||
if (getWorldObj().isRemote) {
|
if (getWorldObj().isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode == Mode.COPY) {
|
||||||
reader = new RecursiveBlueprintReader(this);
|
reader = new RecursiveBlueprintReader(this);
|
||||||
|
}
|
||||||
sendNetworkUpdate();
|
sendNetworkUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +318,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||||
if ("setName".equals(command)) {
|
if ("setName".equals(command)) {
|
||||||
|
@ -325,10 +345,11 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSubBlueprint(TileEntity sub) {
|
public void addSubBlueprint(TileEntity sub) {
|
||||||
|
if (mode == Mode.COPY) {
|
||||||
addSubBlueprint(new BlockIndex(sub));
|
addSubBlueprint(new BlockIndex(sub));
|
||||||
|
|
||||||
sendNetworkUpdate();
|
sendNetworkUpdate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addSubBlueprint(BlockIndex index) {
|
private void addSubBlueprint(BlockIndex index) {
|
||||||
subBlueprints.add(index);
|
subBlueprints.add(index);
|
||||||
|
@ -348,6 +369,18 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLEDLevel(int led) {
|
public int getLEDLevel(int led) {
|
||||||
return (led == 0 ? isProcessing : box != null && box.isInitialized()) ? 15 : 0;
|
boolean condition = false;
|
||||||
|
switch (led) {
|
||||||
|
case 0:
|
||||||
|
condition = clientIsWorking;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
condition = mode == Mode.COPY && box != null && box.isInitialized();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
condition = mode == Mode.EDIT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return condition ? 15 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
5
common/buildcraft/core/internal/ICustomLEDBlock.java
Normal file
5
common/buildcraft/core/internal/ICustomLEDBlock.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package buildcraft.core.internal;
|
||||||
|
|
||||||
|
public interface ICustomLEDBlock {
|
||||||
|
String[] getLEDSuffixes();
|
||||||
|
}
|
|
@ -15,6 +15,10 @@ public class AverageInt {
|
||||||
|
|
||||||
public AverageInt(int precise) {
|
public AverageInt(int precise) {
|
||||||
this.precise = precise;
|
this.precise = precise;
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
this.data = new int[precise];
|
this.data = new int[precise];
|
||||||
this.pos = 0;
|
this.pos = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,18 @@ package buildcraft.core.list;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import buildcraft.core.lib.inventory.StackHelper;
|
import buildcraft.core.lib.inventory.StackHelper;
|
||||||
import buildcraft.core.lib.utils.FluidUtils;
|
import buildcraft.core.lib.utils.FluidUtils;
|
||||||
|
|
||||||
public class ListMatchHandlerFluid extends ListMatchHandler {
|
public class ListMatchHandlerFluid extends ListMatchHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) {
|
public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) {
|
||||||
if (type == Type.MATERIAL) {
|
if (type == Type.TYPE) {
|
||||||
if (FluidContainerRegistry.isContainer(stack) && FluidContainerRegistry.isContainer(target)) {
|
if (FluidContainerRegistry.isContainer(stack) && FluidContainerRegistry.isContainer(target)) {
|
||||||
ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack);
|
ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack);
|
||||||
ItemStack emptyContainerTarget = FluidContainerRegistry.drainFluidContainer(target);
|
ItemStack emptyContainerTarget = FluidContainerRegistry.drainFluidContainer(target);
|
||||||
|
@ -21,7 +21,7 @@ public class ListMatchHandlerFluid extends ListMatchHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == Type.TYPE) {
|
} else if (type == Type.MATERIAL) {
|
||||||
FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack);
|
FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack);
|
||||||
FluidStack fTarget = FluidUtils.getFluidStackFromItemStack(target);
|
FluidStack fTarget = FluidUtils.getFluidStackFromItemStack(target);
|
||||||
if (fStack != null && fTarget != null) {
|
if (fStack != null && fTarget != null) {
|
||||||
|
@ -33,7 +33,7 @@ public class ListMatchHandlerFluid extends ListMatchHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getClientExamples(Type type, ItemStack stack) {
|
public List<ItemStack> getClientExamples(Type type, ItemStack stack) {
|
||||||
if (type == Type.TYPE) {
|
if (type == Type.MATERIAL) {
|
||||||
FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack);
|
FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack);
|
||||||
if (fStack != null) {
|
if (fStack != null) {
|
||||||
List<ItemStack> examples = new ArrayList<ItemStack>();
|
List<ItemStack> examples = new ArrayList<ItemStack>();
|
||||||
|
@ -44,7 +44,7 @@ public class ListMatchHandlerFluid extends ListMatchHandler {
|
||||||
}
|
}
|
||||||
return examples;
|
return examples;
|
||||||
}
|
}
|
||||||
} else if (type == Type.MATERIAL) {
|
} else if (type == Type.TYPE) {
|
||||||
if (FluidContainerRegistry.isContainer(stack)) {
|
if (FluidContainerRegistry.isContainer(stack)) {
|
||||||
List<ItemStack> examples = new ArrayList<ItemStack>();
|
List<ItemStack> examples = new ArrayList<ItemStack>();
|
||||||
ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack);
|
ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack);
|
||||||
|
|
23
common/buildcraft/core/list/ListTooltipHandler.java
Normal file
23
common/buildcraft/core/list/ListTooltipHandler.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package buildcraft.core.list;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
|
||||||
|
import buildcraft.api.items.IList;
|
||||||
|
import buildcraft.core.lib.utils.StringUtils;
|
||||||
|
|
||||||
|
public class ListTooltipHandler {
|
||||||
|
@SubscribeEvent
|
||||||
|
public void itemTooltipEvent(ItemTooltipEvent event) {
|
||||||
|
if (event.entityPlayer.openContainer instanceof ContainerListNew) {
|
||||||
|
ItemStack list = event.entityPlayer.getCurrentEquippedItem();
|
||||||
|
if (list != null && list.getItem() instanceof IList) {
|
||||||
|
if (((IList) list.getItem()).matches(list, event.itemStack)) {
|
||||||
|
event.toolTip.add(EnumChatFormatting.GREEN + StringUtils.localize("tip.list.matches"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package buildcraft.core.render;
|
package buildcraft.core.render;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
@ -12,6 +14,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
import buildcraft.core.internal.ICustomLEDBlock;
|
||||||
import buildcraft.core.internal.ILEDProvider;
|
import buildcraft.core.internal.ILEDProvider;
|
||||||
import buildcraft.core.lib.block.BlockBuildCraft;
|
import buildcraft.core.lib.block.BlockBuildCraft;
|
||||||
import buildcraft.core.lib.render.RenderEntityBlock;
|
import buildcraft.core.lib.render.RenderEntityBlock;
|
||||||
|
@ -29,12 +32,18 @@ public class RenderLEDTile extends TileEntitySpecialRenderer {
|
||||||
|
|
||||||
public static void registerBlockIcons(IIconRegister register) {
|
public static void registerBlockIcons(IIconRegister register) {
|
||||||
for (Block b : iconMap.keySet().toArray(new Block[iconMap.keySet().size()])) {
|
for (Block b : iconMap.keySet().toArray(new Block[iconMap.keySet().size()])) {
|
||||||
// TODO (7.1): The count of icons is hardcoded here. Consider adding a better way.
|
|
||||||
String base = ResourceUtils.getObjectPrefix(Block.blockRegistry.getNameForObject(b));
|
String base = ResourceUtils.getObjectPrefix(Block.blockRegistry.getNameForObject(b));
|
||||||
iconMap.put(b, new IIcon[] {
|
List<IIcon> icons = new ArrayList<IIcon>();
|
||||||
register.registerIcon(base + "/led_red"),
|
if (b instanceof ICustomLEDBlock) {
|
||||||
register.registerIcon(base + "/led_green")
|
for (String s : ((ICustomLEDBlock) b).getLEDSuffixes()) {
|
||||||
});
|
icons.add(register.registerIcon(base + "/" + s));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
icons.add(register.registerIcon(base + "/led_red"));
|
||||||
|
icons.add(register.registerIcon(base + "/led_green"));
|
||||||
|
}
|
||||||
|
|
||||||
|
iconMap.put(b, icons.toArray(new IIcon[icons.size()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +67,10 @@ public class RenderLEDTile extends TileEntitySpecialRenderer {
|
||||||
GL11.glScalef(Z_OFFSET, Z_OFFSET, Z_OFFSET);
|
GL11.glScalef(Z_OFFSET, Z_OFFSET, Z_OFFSET);
|
||||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
IIcon[] icons = iconMap.get(block);
|
||||||
renderBox.texture = iconMap.get(block)[i];
|
|
||||||
|
for (int i = 0; i < icons.length; i++) {
|
||||||
|
renderBox.texture = icons[i];
|
||||||
if (((BlockBuildCraft) block).isRotatable()) {
|
if (((BlockBuildCraft) block).isRotatable()) {
|
||||||
renderBox.setRenderSingleSide(((BlockBuildCraft) block).getFrontSide(tile.getBlockMetadata()));
|
renderBox.setRenderSingleSide(((BlockBuildCraft) block).getFrontSide(tile.getBlockMetadata()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -71,8 +82,10 @@ public class RenderLEDTile extends TileEntitySpecialRenderer {
|
||||||
renderBox.renderSide[5] = true;
|
renderBox.renderSide[5] = true;
|
||||||
}
|
}
|
||||||
renderBox.light = provider.getLEDLevel(i);
|
renderBox.light = provider.getLEDLevel(i);
|
||||||
|
if (renderBox.light > 0) {
|
||||||
RenderEntityBlock.INSTANCE.renderBlock(renderBox);
|
RenderEntityBlock.INSTANCE.renderBlock(renderBox);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -28,6 +28,15 @@ public class AIRobotSearchBlock extends AIRobot {
|
||||||
private double maxDistanceToEnd;
|
private double maxDistanceToEnd;
|
||||||
private IZone zone;
|
private IZone zone;
|
||||||
|
|
||||||
|
public AIRobotSearchBlock(EntityRobotBase iRobot) {
|
||||||
|
super(iRobot);
|
||||||
|
|
||||||
|
zone = iRobot.getZoneToWork();
|
||||||
|
blockFound = null;
|
||||||
|
pathFound = null;
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
|
||||||
public AIRobotSearchBlock(EntityRobotBase iRobot, boolean random, IBlockFilter iPathFound,
|
public AIRobotSearchBlock(EntityRobotBase iRobot, boolean random, IBlockFilter iPathFound,
|
||||||
double iMaxDistanceToEnd) {
|
double iMaxDistanceToEnd) {
|
||||||
super(iRobot);
|
super(iRobot);
|
||||||
|
|
|
@ -32,6 +32,7 @@ import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.core.CompatHooks;
|
import buildcraft.core.CompatHooks;
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.lib.block.TileBuildCraft;
|
import buildcraft.core.lib.block.TileBuildCraft;
|
||||||
|
import buildcraft.core.lib.utils.AverageInt;
|
||||||
import buildcraft.transport.network.PacketPowerUpdate;
|
import buildcraft.transport.network.PacketPowerUpdate;
|
||||||
import buildcraft.transport.pipes.PipePowerCobblestone;
|
import buildcraft.transport.pipes.PipePowerCobblestone;
|
||||||
import buildcraft.transport.pipes.PipePowerDiamond;
|
import buildcraft.transport.pipes.PipePowerDiamond;
|
||||||
|
@ -47,7 +48,6 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
||||||
public static final Map<Class<? extends Pipe<?>>, Integer> powerCapacities = new HashMap<Class<? extends Pipe<?>>, Integer>();
|
public static final Map<Class<? extends Pipe<?>>, Integer> powerCapacities = new HashMap<Class<? extends Pipe<?>>, Integer>();
|
||||||
public static final Map<Class<? extends Pipe<?>>, Float> powerResistances = new HashMap<Class<? extends Pipe<?>>, Float>();
|
public static final Map<Class<? extends Pipe<?>>, Float> powerResistances = new HashMap<Class<? extends Pipe<?>>, Float>();
|
||||||
|
|
||||||
private static final int DISPLAY_SMOOTHING = 10;
|
|
||||||
private static final int OVERLOAD_TICKS = 60;
|
private static final int OVERLOAD_TICKS = 60;
|
||||||
|
|
||||||
public short[] displayPower = new short[6];
|
public short[] displayPower = new short[6];
|
||||||
|
@ -61,13 +61,12 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
||||||
public int[] dbgEnergyOutput = new int[6];
|
public int[] dbgEnergyOutput = new int[6];
|
||||||
public int[] dbgEnergyOffered = new int[6];
|
public int[] dbgEnergyOffered = new int[6];
|
||||||
|
|
||||||
|
private final AverageInt[] powerAverage = new AverageInt[6];
|
||||||
private final TileEntity[] tiles = new TileEntity[6];
|
private final TileEntity[] tiles = new TileEntity[6];
|
||||||
private final Object[] providers = new Object[6];
|
private final Object[] providers = new Object[6];
|
||||||
|
|
||||||
private boolean needsInit = true;
|
private boolean needsInit = true;
|
||||||
|
|
||||||
private short[] prevDisplayPower = new short[6];
|
|
||||||
|
|
||||||
private int[] powerQuery = new int[6];
|
private int[] powerQuery = new int[6];
|
||||||
|
|
||||||
private long currentDate;
|
private long currentDate;
|
||||||
|
@ -78,6 +77,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
||||||
public PipeTransportPower() {
|
public PipeTransportPower() {
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
powerQuery[i] = 0;
|
powerQuery[i] = 0;
|
||||||
|
powerAverage[i] = new AverageInt(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
||||||
tiles[o] = null;
|
tiles[o] = null;
|
||||||
internalPower[o] = 0;
|
internalPower[o] = 0;
|
||||||
internalNextPower[o] = 0;
|
internalNextPower[o] = 0;
|
||||||
displayPower[o] = 0;
|
powerAverage[o].clear();
|
||||||
}
|
}
|
||||||
providers[o] = getEnergyProvider(o);
|
providers[o] = getEnergyProvider(o);
|
||||||
}
|
}
|
||||||
|
@ -200,10 +200,6 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the power to nearby pipes who requested it
|
|
||||||
System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6);
|
|
||||||
Arrays.fill(displayPower, (short) 0);
|
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
if (internalPower[i] > 0) {
|
if (internalPower[i] > 0) {
|
||||||
int totalPowerQuery = 0;
|
int totalPowerQuery = 0;
|
||||||
|
@ -251,16 +247,17 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayPower[j] += watts;
|
powerAverage[j].push((int) Math.ceil(watts));
|
||||||
displayPower[i] += watts;
|
powerAverage[i].push((int) Math.ceil(watts));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float highestPower = 0.0F;
|
short highestPower = 0;
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
displayPower[i] = (short) Math.ceil((float) (prevDisplayPower[i] * (DISPLAY_SMOOTHING - 1) + displayPower[i]) / DISPLAY_SMOOTHING);
|
powerAverage[i].tick();
|
||||||
|
displayPower[i] = (short) Math.round(powerAverage[i].getAverage());
|
||||||
if (displayPower[i] > highestPower) {
|
if (displayPower[i] > highestPower) {
|
||||||
highestPower = displayPower[i];
|
highestPower = displayPower[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,16 +111,16 @@ public class TriggerPipeContents extends BCStatement implements ITriggerInternal
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case empty:
|
case empty:
|
||||||
for (double s : transportPower.displayPower) {
|
for (short s : transportPower.displayPower) {
|
||||||
if (s > 1e-4) {
|
if (s > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case containsEnergy:
|
case containsEnergy:
|
||||||
for (double s : transportPower.displayPower) {
|
for (short s : transportPower.displayPower) {
|
||||||
if (s > 1e-4) {
|
if (s > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue