fix up zone planner gui, add tablet improvements, merge, etc
This commit is contained in:
commit
605ef0fe28
20 changed files with 208 additions and 64 deletions
|
@ -13,7 +13,5 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public interface IActionExternal extends IStatement {
|
public interface IActionExternal extends IStatement {
|
||||||
|
|
||||||
void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
|
void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
54
buildcraft_resources/LICENSE.DEJAVU
Normal file
54
buildcraft_resources/LICENSE.DEJAVU
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
Fonts are © Bitstream (see below). DejaVu changes are in public domain. Explanation of copyright is on Gnome page on Bitstream Vera fonts. Glyphs imported from Arev fonts are © Tavmjung Bah (see
|
||||||
|
below)
|
||||||
|
|
||||||
|
Bitstream Vera Fonts Copyright
|
||||||
|
---
|
||||||
|
|
||||||
|
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and
|
||||||
|
distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software
|
||||||
|
is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
|
||||||
|
|
||||||
|
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the
|
||||||
|
Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".
|
||||||
|
|
||||||
|
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.
|
||||||
|
|
||||||
|
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
|
||||||
|
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
|
||||||
|
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS
|
||||||
|
IN THE FONT SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font
|
||||||
|
Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
|
||||||
|
|
||||||
|
Arev Fonts Copyright
|
||||||
|
---
|
||||||
|
|
||||||
|
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and
|
||||||
|
distribute the modifications to the Bitstream Vera Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to
|
||||||
|
permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
|
||||||
|
|
||||||
|
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the
|
||||||
|
Fonts, only if the fonts are renamed to names not containing either the words "Tavmjong Bah" or the word "Arev".
|
||||||
|
|
||||||
|
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Tavmjong Bah Arev" names.
|
||||||
|
|
||||||
|
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
|
||||||
|
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT,
|
||||||
|
INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the name of Tavmjong Bah shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written
|
||||||
|
authorization from Tavmjong Bah. For further information, contact: tavmjong @ free . fr.
|
BIN
buildcraft_resources/assets/buildcraftcore/tablet/11.pf2
Normal file
BIN
buildcraft_resources/assets/buildcraftcore/tablet/11.pf2
Normal file
Binary file not shown.
BIN
buildcraft_resources/assets/buildcraftcore/tablet/13.pf2
Normal file
BIN
buildcraft_resources/assets/buildcraftcore/tablet/13.pf2
Normal file
Binary file not shown.
BIN
buildcraft_resources/assets/buildcraftcore/tablet/16.pf2
Normal file
BIN
buildcraft_resources/assets/buildcraftcore/tablet/16.pf2
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
2
buildcraft_resources/changelog/6.4.10
Normal file
2
buildcraft_resources/changelog/6.4.10
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Bugs fixed:
|
||||||
|
Further 1355+ fluid fixes (asie)
|
|
@ -1,3 +1,3 @@
|
||||||
1.6.4:BuildCraft:4.2.2
|
1.6.4:BuildCraft:4.2.2
|
||||||
1.7.2:BuildCraft:6.0.16
|
1.7.2:BuildCraft:6.0.16
|
||||||
1.7.10:BuildCraft:6.4.9
|
1.7.10:BuildCraft:6.4.10
|
||||||
|
|
|
@ -111,20 +111,19 @@ public class ZoneChunk implements ISerializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readData(ByteBuf stream) {
|
public void readData(ByteBuf stream) {
|
||||||
if (stream.readBoolean()) {
|
int flags = stream.readUnsignedByte();
|
||||||
|
if ((flags & 1) != 0) {
|
||||||
property = BitSetUtils.fromByteArray(NetworkUtils.readByteArray(stream));
|
property = BitSetUtils.fromByteArray(NetworkUtils.readByteArray(stream));
|
||||||
}
|
}
|
||||||
fullSet = stream.readBoolean();
|
fullSet = (flags & 2) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeData(ByteBuf stream) {
|
public void writeData(ByteBuf stream) {
|
||||||
|
int flags = (fullSet ? 2 : 0) | (property != null ? 1 : 0);
|
||||||
|
stream.writeByte(flags);
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
stream.writeBoolean(true);
|
|
||||||
NetworkUtils.writeByteArray(stream, BitSetUtils.toByteArray(property));
|
NetworkUtils.writeByteArray(stream, BitSetUtils.toByteArray(property));
|
||||||
} else {
|
}
|
||||||
stream.writeBoolean(false);
|
|
||||||
}
|
|
||||||
stream.writeBoolean(fullSet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
|
@ -125,8 +126,8 @@ public class TankManager<T extends Tank> extends ForwardingList<T> implements IF
|
||||||
public void readData(ByteBuf data) {
|
public void readData(ByteBuf data) {
|
||||||
for (Tank tank : tanks) {
|
for (Tank tank : tanks) {
|
||||||
int fluidId = data.readShort();
|
int fluidId = data.readShort();
|
||||||
if (fluidId > 0) {
|
if (FluidRegistry.getFluid(fluidId) != null) {
|
||||||
tank.setFluid(new FluidStack(fluidId, data.readInt()));
|
tank.setFluid(new FluidStack(FluidRegistry.getFluid(fluidId), data.readInt()));
|
||||||
tank.colorRenderCache = data.readInt();
|
tank.colorRenderCache = data.readInt();
|
||||||
} else {
|
} else {
|
||||||
tank.setFluid(null);
|
tank.setFluid(null);
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
|
||||||
amount -= fluid.amount;
|
amount -= fluid.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.usedFluids.add(new FluidStack(requirement.fluidID, amountUsed));
|
result.usedFluids.add(new FluidStack(requirement.getFluid(), amountUsed));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount == 0) {
|
if (amount == 0) {
|
||||||
|
|
|
@ -6,8 +6,10 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import buildcraft.api.tablet.ITablet;
|
import buildcraft.api.tablet.ITablet;
|
||||||
import buildcraft.api.tablet.TabletBitmap;
|
import buildcraft.api.tablet.TabletBitmap;
|
||||||
import buildcraft.api.tablet.TabletProgram;
|
import buildcraft.api.tablet.TabletProgram;
|
||||||
|
import buildcraft.core.tablet.utils.TabletDrawUtils;
|
||||||
import buildcraft.core.tablet.utils.TabletFont;
|
import buildcraft.core.tablet.utils.TabletFont;
|
||||||
import buildcraft.core.tablet.utils.TabletFontManager;
|
import buildcraft.core.tablet.utils.TabletFontManager;
|
||||||
|
import buildcraft.core.tablet.utils.TabletTextUtils;
|
||||||
|
|
||||||
public class TabletProgramMenu extends TabletProgram {
|
public class TabletProgramMenu extends TabletProgram {
|
||||||
private final ITablet tablet;
|
private final ITablet tablet;
|
||||||
|
@ -18,41 +20,20 @@ public class TabletProgramMenu extends TabletProgram {
|
||||||
this.tablet = tablet;
|
this.tablet = tablet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] split(String text, TabletFont font, int width) {
|
|
||||||
List<String> lines = new ArrayList<String>();
|
|
||||||
|
|
||||||
int x = 0;
|
|
||||||
String line = "";
|
|
||||||
boolean first = true;
|
|
||||||
|
|
||||||
for (String s : text.split(" ")) {
|
|
||||||
String ts = first ? s : " " + s;
|
|
||||||
int w = font.getStringWidth(ts);
|
|
||||||
if (x + w > width) {
|
|
||||||
x = 0;
|
|
||||||
ts = s;
|
|
||||||
lines.add(line);
|
|
||||||
line = "";
|
|
||||||
}
|
|
||||||
x += w;
|
|
||||||
line += ts;
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
if (line.length() > 0) {
|
|
||||||
lines.add(line);
|
|
||||||
}
|
|
||||||
return lines.toArray(new String[lines.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tick(float time) {
|
public void tick(float time) {
|
||||||
t+=time;
|
t+=time;
|
||||||
if (!init && t > 2 && tablet.getSide() == Side.CLIENT) {
|
if (!init && t > 2 && tablet.getSide() == Side.CLIENT) {
|
||||||
TabletBitmap bitmap = new TabletBitmap(244, 306);
|
TabletBitmap bitmap = new TabletBitmap(244, 306);
|
||||||
try {
|
try {
|
||||||
TabletFont font = TabletFontManager.INSTANCE.register("DejaVu11", TabletProgramMenu.class.getClassLoader().getResourceAsStream("assets/buildcraftcore/tablet/11.pf2"));
|
TabletFont font = TabletFontManager.INSTANCE.register("DejaVu11", TabletProgramMenu.class.getClassLoader().getResourceAsStream("assets/buildcraftcore/tablet/11.pf2"));
|
||||||
String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque condimentum, nulla in tincidunt finibus, dolor enim condimentum felis, vitae vulputate lorem turpis nec purus. Nulla iaculis sed turpis in lacinia. Aliquam consectetur leo sit amet placerat blandit. Maecenas euismod magna eros, quis efficitur quam luctus mollis. Nulla facilisi. Quisque tempor turpis ipsum, ut auctor diam hendrerit dictum. Phasellus id viverra purus. Ut sagittis felis eu odio sagittis, vitae mollis felis feugiat. Morbi mi elit, varius id fringilla vel, vehicula ac risus. Curabitur aliquam orci at mollis posuere. Nam vitae neque tincidunt orci rhoncus rutrum.";
|
String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque condimentum, nulla in tincidunt finibus, dolor enim condimentum felis, vitae vulputate lorem turpis nec purus. Nulla iaculis sed turpis in lacinia. Aliquam consectetur leo sit amet placerat blandit. Maecenas euismod magna eros, quis efficitur quam luctus mollis. Nulla facilisi. Quisque tempor turpis ipsum, ut auctor diam hendrerit dictum. Phasellus id viverra purus. Ut sagittis felis eu odio sagittis, vitae mollis felis feugiat. Morbi mi elit, varius id fringilla vel, vehicula ac risus. Curabitur aliquam orci at mollis posuere.";
|
||||||
int y = 0;
|
TabletDrawUtils.drawRect(bitmap, 4, 4, 236, 280, 7);
|
||||||
String[] lines = split(lorem, font, 244);
|
int hxo = (244 - font.getStringWidth("Page 1")) / 2;
|
||||||
|
font.draw(bitmap, "Page 2/4", hxo, 287, 5);
|
||||||
|
int XO = 8;
|
||||||
|
int y = 8;
|
||||||
|
int W = 228;
|
||||||
|
String[] lines = TabletTextUtils.split(lorem, font, W, false);
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
String line = lines[i];
|
String line = lines[i];
|
||||||
String[] words = line.split(" ");
|
String[] words = line.split(" ");
|
||||||
|
@ -62,9 +43,9 @@ public class TabletProgramMenu extends TabletProgram {
|
||||||
for (String s : words) {
|
for (String s : words) {
|
||||||
widthNoSpaces += font.getStringWidth(s);
|
widthNoSpaces += font.getStringWidth(s);
|
||||||
}
|
}
|
||||||
justifyValue = (244 - widthNoSpaces) / (float) (words.length - 1);
|
justifyValue = (W - widthNoSpaces) / (float) (words.length - 1);
|
||||||
}
|
}
|
||||||
float x = 0;
|
float x = XO;
|
||||||
for (String s: words) {
|
for (String s: words) {
|
||||||
x += font.draw(bitmap, s, (int) x, y, 7);
|
x += font.draw(bitmap, s, (int) x, y, 7);
|
||||||
x += justifyValue;
|
x += justifyValue;
|
||||||
|
|
30
common/buildcraft/core/tablet/utils/TabletDrawUtils.java
Normal file
30
common/buildcraft/core/tablet/utils/TabletDrawUtils.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package buildcraft.core.tablet.utils;
|
||||||
|
|
||||||
|
import buildcraft.api.tablet.TabletBitmap;
|
||||||
|
|
||||||
|
public class TabletDrawUtils {
|
||||||
|
private TabletDrawUtils() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawRect(TabletBitmap bitmap, int x, int y, int w, int h, int shade) {
|
||||||
|
int x2 = x + w - 1;
|
||||||
|
int y2 = y + h - 1;
|
||||||
|
for (int i = 0; i < w; i++) {
|
||||||
|
bitmap.set(x + i, y, shade);
|
||||||
|
bitmap.set(x + i, y2, shade);
|
||||||
|
}
|
||||||
|
for (int i = 1; i < (h - 1); i++) {
|
||||||
|
bitmap.set(x, y + i, shade);
|
||||||
|
bitmap.set(x2, y + i, shade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawFilledRect(TabletBitmap bitmap, int x, int y, int w, int h, int shade) {
|
||||||
|
for (int j = 0; j < h; j++) {
|
||||||
|
for (int i = 0; i < w; i++) {
|
||||||
|
bitmap.set(x + i, y + j, bitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
common/buildcraft/core/tablet/utils/TabletTextUtils.java
Normal file
38
common/buildcraft/core/tablet/utils/TabletTextUtils.java
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
package buildcraft.core.tablet.utils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TabletTextUtils {
|
||||||
|
private TabletTextUtils() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] split(String text, TabletFont font, int width, boolean justify) {
|
||||||
|
List<String> lines = new ArrayList<String>();
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
String line = "";
|
||||||
|
boolean first = true;
|
||||||
|
|
||||||
|
for (String s : text.split(" ")) {
|
||||||
|
String ts = first ? s : " " + s;
|
||||||
|
int w = font.getStringWidth(ts);
|
||||||
|
if (x + w > width) {
|
||||||
|
x = 0;
|
||||||
|
ts = s;
|
||||||
|
lines.add(line);
|
||||||
|
line = "";
|
||||||
|
}
|
||||||
|
x += w;
|
||||||
|
line += ts;
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
if (line.length() > 0) {
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
|
return lines.toArray(new String[lines.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
|
@ -46,6 +47,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
|
|
||||||
private int burnTime = 0;
|
private int burnTime = 0;
|
||||||
private float coolingBuffer = 0.0f;
|
private float coolingBuffer = 0.0f;
|
||||||
|
private int tankFuelAmountCache = 0;
|
||||||
|
private int tankCoolantAmountCache = 0;
|
||||||
|
|
||||||
private TankManager<Tank> tankManager = new TankManager<Tank>();
|
private TankManager<Tank> tankManager = new TankManager<Tank>();
|
||||||
private IFuel currentFuel;
|
private IFuel currentFuel;
|
||||||
|
@ -295,33 +298,31 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
switch (id) {
|
switch (id) {
|
||||||
// Fluid Fuel ID
|
// Fluid Fuel ID
|
||||||
case 15:
|
case 15:
|
||||||
if (tankFuel.getFluid() == null) {
|
if (FluidRegistry.getFluid(value) != null) {
|
||||||
tankFuel.setFluid(new FluidStack(value, 0));
|
tankFuel.setFluid(new FluidStack(value, tankFuelAmountCache));
|
||||||
} else {
|
} else {
|
||||||
tankFuel.getFluid().fluidID = value;
|
tankFuel.setFluid(null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Fluid Coolant ID
|
// Fluid Coolant ID
|
||||||
case 16:
|
case 16:
|
||||||
if (tankCoolant.getFluid() == null) {
|
if (FluidRegistry.getFluid(value) != null) {
|
||||||
tankCoolant.setFluid(new FluidStack(value, 0));
|
tankCoolant.setFluid(new FluidStack(value, tankCoolantAmountCache));
|
||||||
} else {
|
} else {
|
||||||
tankCoolant.getFluid().fluidID = value;
|
tankCoolant.setFluid(null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Fluid Fuel amount
|
// Fluid Fuel amount
|
||||||
case 17:
|
case 17:
|
||||||
if (tankFuel.getFluid() == null) {
|
tankFuelAmountCache = value;
|
||||||
tankFuel.setFluid(new FluidStack(0, value));
|
if (tankFuel.getFluid() != null) {
|
||||||
} else {
|
|
||||||
tankFuel.getFluid().amount = value;
|
tankFuel.getFluid().amount = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Fluid Coolant amount
|
// Fluid Coolant amount
|
||||||
case 18:
|
case 18:
|
||||||
if (tankCoolant.getFluid() == null) {
|
tankCoolantAmountCache = value;
|
||||||
tankCoolant.setFluid(new FluidStack(0, value));
|
if (tankCoolant.getFluid() != null) {
|
||||||
} else {
|
|
||||||
tankCoolant.getFluid().amount = value;
|
tankCoolant.getFluid().amount = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -339,8 +340,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
@Override
|
@Override
|
||||||
public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) {
|
public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) {
|
||||||
super.sendGUINetworkData(containerEngine, iCrafting);
|
super.sendGUINetworkData(containerEngine, iCrafting);
|
||||||
iCrafting.sendProgressBarUpdate(containerEngine, 15, tankFuel.getFluid() != null ? tankFuel.getFluid().fluidID : 0);
|
iCrafting.sendProgressBarUpdate(containerEngine, 15, tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null ? tankFuel.getFluid().getFluid().getID() : 0);
|
||||||
iCrafting.sendProgressBarUpdate(containerEngine, 16, tankCoolant.getFluid() != null ? tankCoolant.getFluid().fluidID : 0);
|
iCrafting.sendProgressBarUpdate(containerEngine, 16, tankCoolant.getFluid() != null && tankFuel.getFluid().getFluid() != null ? tankCoolant.getFluid().getFluid().getID() : 0);
|
||||||
iCrafting.sendProgressBarUpdate(containerEngine, 17, tankFuel.getFluid() != null ? tankFuel.getFluid().amount : 0);
|
iCrafting.sendProgressBarUpdate(containerEngine, 17, tankFuel.getFluid() != null ? tankFuel.getFluid().amount : 0);
|
||||||
iCrafting.sendProgressBarUpdate(containerEngine, 18, tankCoolant.getFluid() != null ? tankCoolant.getFluid().amount : 0);
|
iCrafting.sendProgressBarUpdate(containerEngine, 18, tankCoolant.getFluid() != null ? tankCoolant.getFluid().amount : 0);
|
||||||
iCrafting.sendProgressBarUpdate(containerEngine, 19, tankFuel.colorRenderCache);
|
iCrafting.sendProgressBarUpdate(containerEngine, 19, tankFuel.colorRenderCache);
|
||||||
|
|
|
@ -120,7 +120,7 @@ public final class CoolantManager implements ICoolantManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int liquidAmount = (int) (stack.stackSize * liquid.fluidStack.amount * multiplier / solid.stack.stackSize);
|
int liquidAmount = (int) (stack.stackSize * liquid.fluidStack.amount * multiplier / solid.stack.stackSize);
|
||||||
return new FluidStack(liquid.fluidStack.fluidID, liquidAmount);
|
return new FluidStack(liquid.fluidStack.getFluid(), liquidAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1121,7 +1121,7 @@ public class EntityRobot extends EntityRobotBase implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||||
if (tank != null && tank.fluidID == resource.fluidID) {
|
if (tank != null && tank.isFluidEqual(resource)) {
|
||||||
return drain(from, resource.amount, doDrain);
|
return drain(from, resource.amount, doDrain);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1161,14 +1161,14 @@ public class EntityRobot extends EntityRobotBase implements
|
||||||
return tank == null
|
return tank == null
|
||||||
|| tank.amount == 0
|
|| tank.amount == 0
|
||||||
|| (tank.amount < maxFluid
|
|| (tank.amount < maxFluid
|
||||||
&& tank.fluidID == fluid.getID());
|
&& tank.getFluid().getID() == fluid.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||||
return tank != null
|
return tank != null
|
||||||
&& tank.amount != 0
|
&& tank.amount != 0
|
||||||
&& tank.fluidID == fluid.getID();
|
&& tank.getFluid().getID() == fluid.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,17 +8,26 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.robotics;
|
package buildcraft.robotics;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import buildcraft.BuildCraftCore;
|
||||||
|
import buildcraft.api.core.IZone;
|
||||||
|
import buildcraft.api.items.IMapLocation;
|
||||||
import buildcraft.api.items.INamedItem;
|
import buildcraft.api.items.INamedItem;
|
||||||
import buildcraft.core.ItemMapLocation;
|
import buildcraft.core.ItemMapLocation;
|
||||||
import buildcraft.core.ZonePlan;
|
import buildcraft.core.ZonePlan;
|
||||||
import buildcraft.core.lib.block.TileBuildCraft;
|
import buildcraft.core.lib.block.TileBuildCraft;
|
||||||
import buildcraft.core.lib.inventory.SimpleInventory;
|
import buildcraft.core.lib.inventory.SimpleInventory;
|
||||||
|
import buildcraft.core.lib.network.Packet;
|
||||||
|
import buildcraft.core.lib.network.command.CommandWriter;
|
||||||
|
import buildcraft.core.lib.network.command.PacketCommand;
|
||||||
import buildcraft.core.lib.utils.NetworkUtils;
|
import buildcraft.core.lib.utils.NetworkUtils;
|
||||||
|
import buildcraft.robotics.gui.ContainerZonePlan;
|
||||||
|
|
||||||
public class TileZonePlan extends TileBuildCraft implements IInventory {
|
public class TileZonePlan extends TileBuildCraft implements IInventory {
|
||||||
|
|
||||||
|
@ -35,7 +44,7 @@ public class TileZonePlan extends TileBuildCraft implements IInventory {
|
||||||
private ZonePlan[] selectedAreas = new ZonePlan[16];
|
private ZonePlan[] selectedAreas = new ZonePlan[16];
|
||||||
private int currentSelectedArea = 0;
|
private int currentSelectedArea = 0;
|
||||||
|
|
||||||
private SimpleInventory inv = new SimpleInventory(2, "inv", 64);
|
private SimpleInventory inv = new SimpleInventory(3, "inv", 64);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
@ -132,6 +141,28 @@ public class TileZonePlan extends TileBuildCraft implements IInventory {
|
||||||
mapName = NetworkUtils.readUTF(stream);
|
mapName = NetworkUtils.readUTF(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void importMap(ItemStack stack) {
|
||||||
|
if (stack.getItem() instanceof IMapLocation) {
|
||||||
|
final IZone zone = ((IMapLocation) stack.getItem()).getZone(stack);
|
||||||
|
if (zone != null && zone instanceof ZonePlan) {
|
||||||
|
selectedAreas[currentSelectedArea] = (ZonePlan) zone;
|
||||||
|
|
||||||
|
for (EntityPlayer e : (List<EntityPlayer>) MinecraftServer.getServer().getConfigurationManager().playerEntityList) {
|
||||||
|
if (e.openContainer != null && e.openContainer instanceof ContainerZonePlan
|
||||||
|
&& ((ContainerZonePlan) e.openContainer).getTile() == this) {
|
||||||
|
Packet p = new PacketCommand(e.openContainer, "areaLoaded", new CommandWriter() {
|
||||||
|
public void write(ByteBuf data) {
|
||||||
|
((ZonePlan) zone).writeData(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
BuildCraftCore.instance.sendToPlayer(e, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ZonePlan selectArea(int index) {
|
public ZonePlan selectArea(int index) {
|
||||||
if (selectedAreas[index] == null) {
|
if (selectedAreas[index] == null) {
|
||||||
selectedAreas[index] = new ZonePlan();
|
selectedAreas[index] = new ZonePlan();
|
||||||
|
@ -170,6 +201,9 @@ public class TileZonePlan extends TileBuildCraft implements IInventory {
|
||||||
public void setInventorySlotContents(int slotId, ItemStack itemstack) {
|
public void setInventorySlotContents(int slotId, ItemStack itemstack) {
|
||||||
inv.setInventorySlotContents(slotId, itemstack);
|
inv.setInventorySlotContents(slotId, itemstack);
|
||||||
|
|
||||||
|
if (!worldObj.isRemote && slotId == 2) {
|
||||||
|
importMap(itemstack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class ContainerZonePlan extends BuildCraftContainer implements ICommandRe
|
||||||
|
|
||||||
addSlotToContainer(new Slot(iZonePlan, 0, 233, 9));
|
addSlotToContainer(new Slot(iZonePlan, 0, 233, 9));
|
||||||
addSlotToContainer(new SlotOutput(iZonePlan, 1, 233, 57));
|
addSlotToContainer(new SlotOutput(iZonePlan, 1, 233, 57));
|
||||||
|
addSlotToContainer(new Slot(iZonePlan, 2, 8, 125));
|
||||||
|
|
||||||
// Player inventory
|
// Player inventory
|
||||||
for (int l = 0; l < 3; l++) {
|
for (int l = 0; l < 3; l++) {
|
||||||
|
@ -54,6 +55,10 @@ public class ContainerZonePlan extends BuildCraftContainer implements ICommandRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TileZonePlan getTile() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import buildcraft.core.ZonePlan;
|
||||||
import buildcraft.core.lib.gui.AdvancedSlot;
|
import buildcraft.core.lib.gui.AdvancedSlot;
|
||||||
import buildcraft.core.lib.gui.GuiAdvancedInterface;
|
import buildcraft.core.lib.gui.GuiAdvancedInterface;
|
||||||
import buildcraft.core.lib.gui.buttons.GuiBetterButton;
|
import buildcraft.core.lib.gui.buttons.GuiBetterButton;
|
||||||
|
import buildcraft.core.lib.gui.buttons.StandardButtonTextureSets;
|
||||||
import buildcraft.core.lib.gui.tooltips.ToolTip;
|
import buildcraft.core.lib.gui.tooltips.ToolTip;
|
||||||
import buildcraft.core.lib.gui.tooltips.ToolTipLine;
|
import buildcraft.core.lib.gui.tooltips.ToolTipLine;
|
||||||
import buildcraft.core.lib.network.command.CommandWriter;
|
import buildcraft.core.lib.network.command.CommandWriter;
|
||||||
|
@ -135,7 +136,7 @@ public class GuiZonePlan extends GuiAdvancedInterface {
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
tool = new GuiBetterButton(0, guiLeft + 5, guiTop + 20, 20, "+");
|
tool = new GuiBetterButton(0, guiLeft + 27, guiTop + 111, 15, StandardButtonTextureSets.SMALL_BUTTON, "+");
|
||||||
tool.setToolTip(new ToolTip(new ToolTipLine(StringUtils.localize("tip.tool.add"))));
|
tool.setToolTip(new ToolTip(new ToolTipLine(StringUtils.localize("tip.tool.add"))));
|
||||||
buttonList.add(tool);
|
buttonList.add(tool);
|
||||||
|
|
||||||
|
@ -208,7 +209,7 @@ public class GuiZonePlan extends GuiAdvancedInterface {
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
drawTexturedModalRect(guiLeft + colorSelected.x, guiTop + colorSelected.y, 0, 228, 16, 16);
|
drawTexturedModalRect(guiLeft + colorSelected.x, guiTop + colorSelected.y, 0, 228, 16, 16);
|
||||||
drawTexturedModalRect(guiLeft + 236, guiTop + 38, 16, 228, 8,
|
drawTexturedModalRect(guiLeft + 236, guiTop + 27, 16, 228, 8,
|
||||||
(int) ((zonePlan.progress / (float) TileZonePlan.CRAFT_TIME) * 27));
|
(int) ((zonePlan.progress / (float) TileZonePlan.CRAFT_TIME) * 27));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue