Fixed tile assembly table on SMP.
This commit is contained in:
parent
a6c357cb23
commit
fac800c8d2
5 changed files with 140 additions and 38 deletions
|
@ -18,12 +18,13 @@ import net.minecraft.src.buildcraft.api.APIProxy;
|
||||||
import net.minecraft.src.buildcraft.core.AssemblyRecipe;
|
import net.minecraft.src.buildcraft.core.AssemblyRecipe;
|
||||||
import net.minecraft.src.buildcraft.core.CoreProxy;
|
import net.minecraft.src.buildcraft.core.CoreProxy;
|
||||||
import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
|
import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
|
||||||
|
import net.minecraft.src.buildcraft.core.network.PacketCoordinates;
|
||||||
import net.minecraft.src.buildcraft.core.network.PacketIds;
|
import net.minecraft.src.buildcraft.core.network.PacketIds;
|
||||||
import net.minecraft.src.buildcraft.core.network.PacketPayload;
|
import net.minecraft.src.buildcraft.core.network.PacketPayload;
|
||||||
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
||||||
|
import net.minecraft.src.buildcraft.core.utils.StringUtil;
|
||||||
import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
|
import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
|
||||||
import net.minecraft.src.buildcraft.factory.TileAssemblyTable.SelectionMessage;
|
import net.minecraft.src.buildcraft.factory.TileAssemblyTable.SelectionMessage;
|
||||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@ -69,6 +70,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRecipes();
|
updateRecipes();
|
||||||
|
|
||||||
|
// Request current selection from server
|
||||||
|
CoreProxy.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, assemblyTable.xCoord, assemblyTable.yCoord, assemblyTable.zCoord).getPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRecipes() {
|
public void updateRecipes() {
|
||||||
|
@ -154,9 +158,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
||||||
PacketPayload payload = TileAssemblyTable.selectionMessageWrapper.toPayload(container.x, container.y,container.z, message);
|
PacketPayload payload = TileAssemblyTable.selectionMessageWrapper.toPayload(container.x, container.y,container.z, message);
|
||||||
|
|
||||||
PacketUpdate packet = new PacketUpdate(PacketIds.SELECTION_ASSEMBLY, payload);
|
PacketUpdate packet = new PacketUpdate(PacketIds.SELECTION_ASSEMBLY, payload);
|
||||||
packet.posX = container.x;
|
packet.posX = assemblyTable.xCoord;
|
||||||
packet.posY = container.y;
|
packet.posY = assemblyTable.yCoord;
|
||||||
packet.posZ = container.z;
|
packet.posZ = assemblyTable.zCoord;
|
||||||
|
|
||||||
CoreProxy.sendToServer(packet.getPacket());
|
CoreProxy.sendToServer(packet.getPacket());
|
||||||
}
|
}
|
||||||
|
|
82
common/lang/buildcraft/sv_SE.properties
Normal file
82
common/lang/buildcraft/sv_SE.properties
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
# sv_SE
|
||||||
|
# Translated by Landrash
|
||||||
|
|
||||||
|
gui.building.resources=Byggmaterial
|
||||||
|
gui.del=Radera
|
||||||
|
gui.filling.resources=Fyllningsmaterial
|
||||||
|
gui.inventory=Inventarie
|
||||||
|
gui.lock=Lås
|
||||||
|
gui.needed=Behövd
|
||||||
|
gui.unlock=Lås upp
|
||||||
|
item.bucketFuel=Bränslehink
|
||||||
|
item.bucketOil=Olje Hink
|
||||||
|
item.woodenGearItem=Träkugghjul
|
||||||
|
item.stoneGearItem=Stenkugghjul
|
||||||
|
item.ironGearItem=Järnkugghjul
|
||||||
|
item.goldGearItem=Guldkugghjul
|
||||||
|
item.diamondGearItem=Diamantkugghjul
|
||||||
|
item.templateItem=Mall
|
||||||
|
item.wrenchItem=Skiftnyckel
|
||||||
|
item.fuel=Bränsle
|
||||||
|
item.pipeWaterproof=Rörvattentätning
|
||||||
|
item.pipeGate.0=Grind
|
||||||
|
item.pipeGate.1=Järn OCH Grind
|
||||||
|
item.pipeGate.2=Järn ELLER Grind
|
||||||
|
item.pipeGate.3=Guld OCH Grind
|
||||||
|
item.pipeGate.4=Guld ELLER Grind
|
||||||
|
item.pipeGate.5=Diamant OCH Grind
|
||||||
|
item.pipeGate.6=Diamant ELLER Grind
|
||||||
|
item.pipeGateAutarchic.0=Primär Grind
|
||||||
|
item.pipeGateAutarchic.1=Primär Järn OCH Grind
|
||||||
|
item.pipeGateAutarchic.2=Primär Järn ELLER Grind
|
||||||
|
item.pipeGateAutarchic.3=Primär Guld OCH Grind
|
||||||
|
item.pipeGateAutarchic.4=Primär Guld ELLER Grind
|
||||||
|
item.pipeGateAutarchic.5=Primär Diamant OCH Grind
|
||||||
|
item.pipeGateAutarchic.6=Primär Diamant ELLER Grind
|
||||||
|
item.redPipeWire=Röd Rörledning
|
||||||
|
item.bluePipeWire=Blå Rörledning
|
||||||
|
item.greenPipeWire=Grön Rörledning
|
||||||
|
item.yellowPipeWire=Gul Rörledning
|
||||||
|
item.redstoneChipset.0=Rödsten Chipset
|
||||||
|
item.redstoneChipset.1=Rödsten Järn Chipset
|
||||||
|
item.redstoneChipset.2=Rödsten Guld Chipset
|
||||||
|
item.redstoneChipset.3=Rödsten Diamant Chipset
|
||||||
|
item.redstoneChipset.4=Pulserande Chipset
|
||||||
|
item.blueprintItem=Ritning
|
||||||
|
item.PipeItemsWood=Trä Transport Rör
|
||||||
|
item.PipeItemsCobblestone=Kullersten Transport Rör
|
||||||
|
item.PipeItemsStone=Sten Transport Rör
|
||||||
|
item.PipeItemsIron=Järn Transport Rör
|
||||||
|
item.PipeItemsGold=Guld Transport Rör
|
||||||
|
item.PipeItemsDiamond=Diamant Transport Rör
|
||||||
|
item.PipeItemsObsidian=Obsidian Transport Rör
|
||||||
|
item.PipeLiquidsWood=Vattentätt Trä Rör
|
||||||
|
item.PipeLiquidsCobblestone=Vattentätt Kullerstens Rör
|
||||||
|
item.PipeLiquidsStone=Vattentätt Sten Rör
|
||||||
|
item.PipeLiquidsIron=Vattentätt Järn Rör
|
||||||
|
item.PipeLiquidsGold=Vattentätt Guld Rör
|
||||||
|
item.PipePowerWood=Konduktivt Trä Rör
|
||||||
|
item.PipePowerStone=Konduktivt Sten Rör
|
||||||
|
item.PipePowerGold=Konduktivt Guld Rör
|
||||||
|
item.PipeItemsStripes=Randigt Transport Rör
|
||||||
|
item.PipeStructureCobblestone=Kullerstens Struktur Rör
|
||||||
|
tile.miningWellBlock=Gruv Borr
|
||||||
|
tile.plainPipeBlock=Gruv Rör
|
||||||
|
tile.autoWorkBenchBlock=Automatiskt Arbetsbänk
|
||||||
|
tile.machineBlock=Stenbrott
|
||||||
|
tile.markerBlock=Land Märke
|
||||||
|
tile.fillerBlock=Fyllare
|
||||||
|
tile.builderBlock=Byggare
|
||||||
|
tile.architectBlock=Architektbord
|
||||||
|
tile.frameBlock=Ram
|
||||||
|
tile.tankBlock=Tank
|
||||||
|
tile.refineryBlock=Raffinaderi
|
||||||
|
tile.libraryBlock=Ritnings Bibliotek
|
||||||
|
tile.laserBlock=Laser
|
||||||
|
tile.assemblyTableBlock=Monterings Bänk
|
||||||
|
tile.pathMarkerBlock=Väg Markör
|
||||||
|
tile.blockHopper=Hopper
|
||||||
|
tile.pumpBlock=Pump
|
||||||
|
tile.engineWood=Rödsten Motor
|
||||||
|
tile.engineStone=Ång Motor
|
||||||
|
tile.engineIron=Förbrännings Motor
|
|
@ -3,8 +3,10 @@ package net.minecraft.src.buildcraft.factory;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import net.minecraft.src.BuildCraftCore;
|
import net.minecraft.src.BuildCraftCore;
|
||||||
|
import net.minecraft.src.Container;
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.src.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
|
import net.minecraft.src.ICrafting;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.src.IInventory;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.src.NBTTagCompound;
|
||||||
|
@ -30,6 +32,7 @@ public class TileAssemblyTable extends TileEntity implements IInventory, IPipeCo
|
||||||
|
|
||||||
public AssemblyRecipe currentRecipe;
|
public AssemblyRecipe currentRecipe;
|
||||||
|
|
||||||
|
private float currentRequiredEnergy = 0;
|
||||||
private float energyStored = 0;
|
private float energyStored = 0;
|
||||||
|
|
||||||
public static class SelectionMessage {
|
public static class SelectionMessage {
|
||||||
|
@ -289,25 +292,33 @@ public class TileAssemblyTable extends TileEntity implements IInventory, IPipeCo
|
||||||
return recipe != null && recipe == currentRecipe;
|
return recipe != null && recipe == currentRecipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCurrentRecipe(AssemblyRecipe recipe) {
|
||||||
|
this.currentRecipe = recipe;
|
||||||
|
if(recipe != null)
|
||||||
|
this.currentRequiredEnergy = recipe.energy;
|
||||||
|
else
|
||||||
|
this.currentRequiredEnergy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void planOutput (AssemblyRecipe recipe) {
|
public void planOutput (AssemblyRecipe recipe) {
|
||||||
if (recipe != null && !isPlanned(recipe)) {
|
if (recipe != null && !isPlanned(recipe)) {
|
||||||
plannedOutput.add(recipe);
|
plannedOutput.add(recipe);
|
||||||
|
|
||||||
if (!isAssembling(currentRecipe) || !isPlanned(currentRecipe)) {
|
if (!isAssembling(currentRecipe) || !isPlanned(currentRecipe)) {
|
||||||
currentRecipe = recipe;
|
setCurrentRecipe(recipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelPlanOutput(AssemblyRecipe recipe) {
|
public void cancelPlanOutput(AssemblyRecipe recipe) {
|
||||||
if (isAssembling(recipe)) {
|
if (isAssembling(recipe)) {
|
||||||
currentRecipe = null;
|
setCurrentRecipe(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
plannedOutput.remove(recipe);
|
plannedOutput.remove(recipe);
|
||||||
|
|
||||||
if (plannedOutput.size() != 0) {
|
if (plannedOutput.size() != 0) {
|
||||||
currentRecipe = plannedOutput.getFirst();
|
setCurrentRecipe(plannedOutput.getFirst());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,19 +329,19 @@ public class TileAssemblyTable extends TileEntity implements IInventory, IPipeCo
|
||||||
if (recipe == currentRecipe) {
|
if (recipe == currentRecipe) {
|
||||||
takeNext = true;
|
takeNext = true;
|
||||||
} else if (takeNext && recipe.canBeDone(items)) {
|
} else if (takeNext && recipe.canBeDone(items)) {
|
||||||
currentRecipe = recipe;
|
setCurrentRecipe(recipe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AssemblyRecipe recipe : plannedOutput) {
|
for (AssemblyRecipe recipe : plannedOutput) {
|
||||||
if (recipe.canBeDone(items)) {
|
if (recipe.canBeDone(items)) {
|
||||||
currentRecipe = recipe;
|
setCurrentRecipe(recipe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentRecipe = null;
|
setCurrentRecipe(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -339,13 +350,13 @@ public class TileAssemblyTable extends TileEntity implements IInventory, IPipeCo
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSelectionMessage(SelectionMessage message) {
|
public void handleSelectionMessage(SelectionMessage message) {
|
||||||
for (AssemblyRecipe r : BuildCraftCore.assemblyRecipes) {
|
for (AssemblyRecipe recipe : BuildCraftCore.assemblyRecipes) {
|
||||||
if (r.output.itemID == message.itemID
|
if (recipe.output.itemID == message.itemID
|
||||||
&& r.output.getItemDamage() == message.itemDmg) {
|
&& recipe.output.getItemDamage() == message.itemDmg) {
|
||||||
if (message.select) {
|
if (message.select) {
|
||||||
planOutput(r);
|
planOutput(recipe);
|
||||||
} else {
|
} else {
|
||||||
cancelPlanOutput(r);
|
cancelPlanOutput(recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -375,4 +386,24 @@ public class TileAssemblyTable extends TileEntity implements IInventory, IPipeCo
|
||||||
mod_BuildCraftSilicon.instance);
|
mod_BuildCraftSilicon.instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SMP GUI */
|
||||||
|
public void getGUINetworkData(int i, int j) {
|
||||||
|
switch(i)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
currentRequiredEnergy = j;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
energyStored = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||||
|
iCrafting.updateCraftingInventoryInfo(container, 0, (int)currentRequiredEnergy);
|
||||||
|
iCrafting.updateCraftingInventoryInfo(container, 1, (int)energyStored);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
package net.minecraft.src.buildcraft.silicon;
|
package net.minecraft.src.buildcraft.silicon;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.ICrafting;
|
import net.minecraft.src.ICrafting;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.src.IInventory;
|
||||||
|
@ -62,30 +61,16 @@ class ContainerAssemblyTable extends BuildCraftContainer {
|
||||||
return table.isUseableByPlayer(entityplayer);
|
return table.isUseableByPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override client side only
|
||||||
|
public void updateProgressBar(int i, int j) {
|
||||||
|
table.getGUINetworkData (i, j);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCraftingResults() {
|
public void updateCraftingResults() {
|
||||||
super.updateCraftingResults();
|
super.updateCraftingResults();
|
||||||
|
|
||||||
for (int i = 0; i < crafters.size(); i++) {
|
for(int i = 0; i < crafters.size(); i++)
|
||||||
ICrafting crafting = (ICrafting) crafters.get(i);
|
table.sendGUINetworkData (this, (ICrafting)crafters.get(i));
|
||||||
|
|
||||||
crafting.updateCraftingInventoryInfo(this, 0, table.xCoord);
|
|
||||||
crafting.updateCraftingInventoryInfo(this, 1, table.yCoord);
|
|
||||||
crafting.updateCraftingInventoryInfo(this, 2, table.zCoord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateProgressBar(int i, int j) {
|
|
||||||
if (i == 0) {
|
|
||||||
x = j;
|
|
||||||
} else if (i == 1) {
|
|
||||||
y = j;
|
|
||||||
} else if (i == 2) {
|
|
||||||
z = j;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!networkSynchronized && x != Integer.MAX_VALUE && y != Integer.MAX_VALUE && z != Integer.MAX_VALUE)
|
|
||||||
networkSynchronized = true;
|
|
||||||
CoreProxy.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, x, y, z).getPacket());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue