Merge branch 'nightly' into marmot
This commit is contained in:
commit
f353d04feb
4 changed files with 36 additions and 42 deletions
|
@ -1,7 +1,5 @@
|
|||
package buildcraft.energy.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenDesert;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
|
@ -27,8 +25,4 @@ public class BiomeGenOilDesert extends BiomeGenDesert {
|
|||
setTemperatureRainfall(2.0F, 0.0F);
|
||||
setMinMaxHeight(0.1F, 0.2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorate(World par1World, Random par2Random, int par3, int par4) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,13 +216,13 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
private PacketFluidUpdate computeFluidUpdate(boolean initPacket, boolean persistChange) {
|
||||
|
||||
boolean changed = false;
|
||||
BitSet delta = new BitSet(21);
|
||||
BitSet delta = new BitSet(PacketFluidUpdate.FLUID_DATA_NUM * ForgeDirection.VALID_DIRECTIONS.length);
|
||||
|
||||
if (initClient > 0) {
|
||||
initClient--;
|
||||
if (initClient == 1) {
|
||||
changed = true;
|
||||
delta.set(0, 21);
|
||||
delta.set(0, PacketFluidUpdate.FLUID_DATA_NUM * ForgeDirection.VALID_DIRECTIONS.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,36 +233,34 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
FluidStack current = internalTanks[dir.ordinal()].getFluid();
|
||||
FluidStack prev = renderCache[dir.ordinal()];
|
||||
|
||||
if (prev == null && current == null) {
|
||||
if (current != null && current.getFluid() == null)
|
||||
continue;
|
||||
|
||||
if (prev == null && current == null)
|
||||
continue;
|
||||
|
||||
if (prev == null ^ current == null) {
|
||||
changed = true;
|
||||
if (current != null) {
|
||||
renderCache[dir.ordinal()] = current.copy();
|
||||
colorRenderCache[dir.ordinal()] = current.getFluid().getColor(current);
|
||||
} else {
|
||||
renderCache[dir.ordinal()] = null;
|
||||
colorRenderCache[dir.ordinal()] = 0xFFFFFF;
|
||||
}
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_ID_BIT);
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_AMOUNT_BIT);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev == null && current != null) {
|
||||
changed = true;
|
||||
renderCache[dir.ordinal()] = current.copy();
|
||||
colorRenderCache[dir.ordinal()] = current.getFluid().getColor(current);
|
||||
delta.set(dir.ordinal() * 3 + 0);
|
||||
delta.set(dir.ordinal() * 3 + 1);
|
||||
delta.set(dir.ordinal() * 3 + 2);
|
||||
if (prev == null || current == null)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev != null && current == null) {
|
||||
changed = true;
|
||||
renderCache[dir.ordinal()] = null;
|
||||
colorRenderCache[dir.ordinal()] = 0xFFFFFF;
|
||||
delta.set(dir.ordinal() * 3 + 0);
|
||||
delta.set(dir.ordinal() * 3 + 1);
|
||||
delta.set(dir.ordinal() * 3 + 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!prev.equals(current) || initPacket) {
|
||||
changed = true;
|
||||
renderCache[dir.ordinal()] = current;
|
||||
colorRenderCache[dir.ordinal()] = current.getFluid().getColor(current);
|
||||
delta.set(dir.ordinal() * 3 + 0);
|
||||
delta.set(dir.ordinal() * 3 + 1);
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_ID_BIT);
|
||||
}
|
||||
|
||||
int displayQty = (prev.amount * 4 + current.amount) / 5;
|
||||
|
@ -274,7 +272,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
if (prev.amount != displayQty || initPacket) {
|
||||
changed = true;
|
||||
renderCache[dir.ordinal()].amount = displayQty;
|
||||
delta.set(dir.ordinal() * 3 + 2);
|
||||
delta.set(dir.ordinal() * PacketFluidUpdate.FLUID_DATA_NUM + PacketFluidUpdate.FLUID_AMOUNT_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class PacketFluidUpdate extends PacketCoordinates {
|
||||
|
||||
public static int FLUID_ID_BIT = 0;
|
||||
public static int FLUID_AMOUNT_BIT = 1;
|
||||
public static int FLUID_DATA_NUM = 2;
|
||||
|
||||
public FluidStack[] renderCache = new FluidStack[ForgeDirection.values().length];
|
||||
public int[] colorRenderCache = new int[ForgeDirection.values().length];
|
||||
|
@ -56,19 +60,19 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
renderCache = transLiq.renderCache;
|
||||
colorRenderCache = transLiq.colorRenderCache;
|
||||
|
||||
byte[] dBytes = new byte[3];
|
||||
byte[] dBytes = new byte[2];
|
||||
data.read(dBytes);
|
||||
delta = fromByteArray(dBytes);
|
||||
|
||||
// System.out.printf("read %d, %d, %d = %s, %s%n", posX, posY, posZ, Arrays.toString(dBytes), delta);
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.values()) {
|
||||
if (delta.get(dir.ordinal() * 3 + 0)) {
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_ID_BIT)) {
|
||||
int amt = renderCache[dir.ordinal()] != null ? renderCache[dir.ordinal()].amount : 0;
|
||||
renderCache[dir.ordinal()] = new FluidStack(data.readInt(), amt);
|
||||
renderCache[dir.ordinal()] = new FluidStack(data.readShort(), amt);
|
||||
colorRenderCache[dir.ordinal()] = data.readInt();
|
||||
}
|
||||
if (delta.get(dir.ordinal() * 3 + 2)) {
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_AMOUNT_BIT)) {
|
||||
if (renderCache[dir.ordinal()] == null) {
|
||||
renderCache[dir.ordinal()] = new FluidStack(0,0);
|
||||
}
|
||||
|
@ -88,16 +92,16 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
for (ForgeDirection dir : ForgeDirection.values()) {
|
||||
FluidStack liquid = renderCache[dir.ordinal()];
|
||||
|
||||
if (delta.get(dir.ordinal() * 3 + 0)) {
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_ID_BIT)) {
|
||||
if (liquid != null) {
|
||||
data.writeInt(liquid.fluidID);
|
||||
data.writeShort(liquid.fluidID);
|
||||
data.writeInt(colorRenderCache[dir.ordinal()]);
|
||||
} else {
|
||||
data.writeInt(0);
|
||||
data.writeShort(0);
|
||||
data.writeInt(0xFFFFFF);
|
||||
}
|
||||
}
|
||||
if (delta.get(dir.ordinal() * 3 + 2)) {
|
||||
if (delta.get(dir.ordinal() * FLUID_DATA_NUM + FLUID_AMOUNT_BIT)) {
|
||||
if (liquid != null) {
|
||||
data.writeInt(liquid.amount);
|
||||
} else {
|
||||
|
@ -118,7 +122,7 @@ public class PacketFluidUpdate extends PacketCoordinates {
|
|||
}
|
||||
|
||||
public static byte[] toByteArray(BitSet bits) {
|
||||
byte[] bytes = new byte[3];
|
||||
byte[] bytes = new byte[2];
|
||||
for (int i = 0; i < bits.length(); i++) {
|
||||
if (bits.get(i)) {
|
||||
bytes[bytes.length - i / 8 - 1] |= 1 << (i % 8);
|
||||
|
|
|
@ -2,13 +2,11 @@ package buildcraft.transport.render;
|
|||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.transport.ItemPipe;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
@ -22,7 +20,7 @@ public class PipeItemRenderer implements IItemRenderer {
|
|||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Block block = BuildCraftTransport.genericPipeBlock;
|
||||
Icon icon = ((ItemPipe) Item.itemsList[item.itemID]).getIconFromDamage(0);
|
||||
Icon icon = item.getItem().getIconFromDamage(0);
|
||||
|
||||
if (icon == null)
|
||||
icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
|
||||
|
|
Loading…
Reference in a new issue