last set of fixes for blueprints authoring
This commit is contained in:
parent
5c5819f28d
commit
4ab0eaf290
5 changed files with 29 additions and 17 deletions
|
@ -126,7 +126,7 @@ item.redstone_pulsating_chipset.name=Pulsating Chipset
|
|||
item.redstone_quartz_chipset.name=Quartz Chipset
|
||||
item.redstone_comp_chipset.name=Redstone Comp Chipset
|
||||
item.blueprintItem.name=Blueprint
|
||||
item.blueprint.author=Author
|
||||
item.blueprint.author=by
|
||||
item.blueprint.blank=Blank
|
||||
item.PipeItemsWood.name=Wooden Transport Pipe
|
||||
item.PipeItemsCobblestone.name=Cobblestone Transport Pipe
|
||||
|
|
|
@ -34,7 +34,7 @@ public abstract class ItemBlueprint extends ItemBuildCraft {
|
|||
|
||||
if (blueprint != null) {
|
||||
list.add(String.format(blueprint.id.name));
|
||||
list.add(String.format(StringUtils.localize("item.blueprint.author"), blueprint.author));
|
||||
list.add(String.format(StringUtils.localize("item.blueprint.author") + " " + blueprint.author));
|
||||
} else
|
||||
list.add(StringUtils.localize("item.blueprint.blank"));
|
||||
}
|
||||
|
|
|
@ -45,9 +45,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
public @NetworkData
|
||||
String name = "";
|
||||
|
||||
// Use that field to avoid creating several times the same template if
|
||||
// they're the same!
|
||||
private int lastBptId = 0;
|
||||
public String currentAuthorName = "";
|
||||
|
||||
public TileArchitect() {
|
||||
box.kind = Kind.STRIPES;
|
||||
|
@ -101,6 +99,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
|
||||
if (!name.equals("")) {
|
||||
result.id.name = name;
|
||||
result.author = currentAuthorName;
|
||||
}
|
||||
|
||||
result.anchorX = xCoord - box.xMin;
|
||||
|
@ -256,7 +255,6 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
lastBptId = nbttagcompound.getInteger("lastTemplateId");
|
||||
computingTime = nbttagcompound.getInteger("computingTime");
|
||||
isComputing = nbttagcompound.getBoolean("isComputing");
|
||||
|
||||
|
@ -278,13 +276,13 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
}
|
||||
|
||||
name = nbttagcompound.getString("name");
|
||||
currentAuthorName = nbttagcompound.getString("lastAuthor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound.setInteger("lastTemplateId", lastBptId);
|
||||
nbttagcompound.setInteger("computingTime", computingTime);
|
||||
nbttagcompound.setBoolean("isComputing", isComputing);
|
||||
|
||||
|
@ -306,6 +304,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
|
||||
nbttagcompound.setTag("Items", nbttaglist);
|
||||
nbttagcompound.setString("name", name);
|
||||
nbttagcompound.setString("lastAuthor", currentAuthorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,6 +13,9 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
|
||||
|
@ -61,7 +64,7 @@ public final class BlueprintId implements Comparable<BlueprintId> {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(uniqueId);
|
||||
return Arrays.hashCode(ArrayUtils.addAll(uniqueId, name.getBytes()));
|
||||
}
|
||||
|
||||
public String getCompleteId () {
|
||||
|
|
|
@ -8,23 +8,24 @@
|
|||
*/
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
public class ContainerArchitect extends BuildCraftContainer {
|
||||
|
||||
protected IInventory playerIInventory;
|
||||
protected TileArchitect template;
|
||||
protected TileArchitect architect;
|
||||
protected int computingTime = 0;
|
||||
|
||||
public ContainerArchitect(IInventory playerInventory, TileArchitect template) {
|
||||
super(template.getSizeInventory());
|
||||
this.playerIInventory = playerInventory;
|
||||
this.template = template;
|
||||
this.architect = template;
|
||||
|
||||
addSlotToContainer(new Slot(template, 0, 55, 35));
|
||||
addSlotToContainer(new Slot(template, 1, 114, 35));
|
||||
|
@ -52,24 +53,33 @@ public class ContainerArchitect extends BuildCraftContainer {
|
|||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) crafters.get(i);
|
||||
if (computingTime != template.computingTime) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, template.computingTime);
|
||||
if (computingTime != architect.computingTime) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, architect.computingTime);
|
||||
}
|
||||
}
|
||||
|
||||
computingTime = template.computingTime;
|
||||
computingTime = architect.computingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (i == 0) {
|
||||
template.computingTime = j;
|
||||
architect.computingTime = j;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return template.isUseableByPlayer(entityplayer);
|
||||
return architect.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
||||
if (slotNum == 0) {
|
||||
architect.currentAuthorName = player.getDisplayName();
|
||||
}
|
||||
|
||||
return super.slotClick(slotNum, mouseButton, modifier, player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue