make AWBs only accept recipe-relevant items again, restore Java 6 compat, fix #2765

This commit is contained in:
Adrian 2015-06-09 08:09:33 +02:00
parent 1e3f270d5c
commit 7e16217021
2 changed files with 18 additions and 14 deletions

View file

@ -11,7 +11,7 @@ package buildcraft;
import java.util.EnumMap;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@ -116,7 +116,7 @@ public class BuildCraftMod {
}
static class PacketSender implements Runnable {
private Queue<SendRequest> packets = new ConcurrentLinkedDeque<SendRequest>();
private Queue<SendRequest> packets = new ConcurrentLinkedQueue<SendRequest>();
@Override
public void run() {
@ -131,7 +131,8 @@ public class BuildCraftMod {
SendRequest r = packets.remove();
S3FPacketCustomPayload packetCustomPayload = new S3FPacketCustomPayload();
net.minecraft.network.Packet p = r.source.channels.get(Side.SERVER).generatePacketFrom(r.packet);
for (EntityPlayerMP player : (List<EntityPlayerMP>) MinecraftServer.getServer().getConfigurationManager().playerEntityList) {
List<EntityPlayerMP> playerList = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayerMP player : playerList.toArray(new EntityPlayerMP[playerList.size()])) {
if (r.isValid(player)) {
NetHandlerPlayServer handler = player.playerNetServerHandler;
if (handler == null) {
@ -183,16 +184,6 @@ public class BuildCraftMod {
sender.add(new PlayerSendRequest(this, packet, entityplayer));
}
/* public void sendToAll(Packet packet) {
try {
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
.set(FMLOutboundHandler.OutboundTarget.ALL);
channels.get(Side.SERVER).writeOutbound(packet);
} catch (Throwable t) {
BCLog.logger.log(Level.WARN, "sendToAll crash", t);
}
} */
public void sendToServer(Packet packet) {
try {
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);

View file

@ -428,7 +428,20 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side) {
return slot < 9;
if (slot >= 9) {
return false;
}
ItemStack slotStack = inv.getStackInSlot(slot);
if (StackHelper.canStacksMerge(stack, slotStack)) {
return true;
}
for (int i = 0; i < 9; i++) {
ItemStack inputStack = craftMatrix.getStackInSlot(i);
if (inputStack != null && StackHelper.isMatchingItem(inputStack, stack, true, false)) {
return true;
}
}
return false;
}
@Override