This commit is contained in:
Adrian 2015-08-05 15:37:40 +02:00
parent 10b4468e7c
commit 65544263fd
8 changed files with 40 additions and 12 deletions

View file

@ -1,4 +1,5 @@
Bugs fixed:
* Creative Only blueprints partially working in Survival worlds (asie)
* Incorrect behaviour with Forestry/RailCraft engines (asie - workaround, actually bug on their side)
* Overly dark water with non-sky lighting (asie)

View file

@ -94,8 +94,6 @@ public class BuildCraftFactory extends BuildCraftMod {
public void load(FMLInitializationEvent evt) {
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new FactoryGuiHandler());
// EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);
CoreProxy.proxy.registerTileEntity(TileMiningWell.class, "MiningWell");
CoreProxy.proxy.registerTileEntity(TileAutoWorkbench.class, "AutoWorkbench");
CoreProxy.proxy.registerTileEntity(TilePump.class, "net.minecraft.src.buildcraft.factory.TilePump");

View file

@ -47,7 +47,7 @@ public class RecursiveBlueprintBuilder {
public BptBuilderBase nextBuilder() {
if (!returnedThis) {
blueprint.adjustToWorld(world, x, y, z, dir);
blueprint = blueprint.adjustToWorld(world, x, y, z, dir);
returnedThis = true;

View file

@ -22,8 +22,6 @@ public final class DefaultProps {
public static String TEXTURE_PATH_ROBOTS = "buildcraftrobotics:textures/entities";
public static final String DEFAULT_LANGUAGE = "en_US";
public static String PUMP_DIMENSION_LIST = "+/*/*,+/-1/lava";
public static double PIPES_DURABILITY = 0.25D;

View file

@ -13,6 +13,7 @@ import java.util.Map;
import com.google.common.collect.MapMaker;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -308,6 +309,15 @@ public class TravelingItem {
return true;
}
@Override
public void finalize() {
// Nasty hack.
if (hasDisplayList) {
GLAllocation.deleteDisplayLists(displayList);
hasDisplayList = false;
}
}
@Override
public String toString() {
return "TravelingItem: " + id;

View file

@ -19,7 +19,8 @@ public class PipePowerEmerald extends PipePowerWood {
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
battery = new RFBattery(2560 * 50, 2560, 0);
battery = new RFBattery(2560 * 50, 2560 * 50, 0);
receiveLimit = 2560;
transport.initFromPipe(this.getClass());
}

View file

@ -39,6 +39,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerWood_Standard.ordinal();
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
protected RFBattery battery;
protected int receiveLimit;
private int requestedEnergy, sources, lastRequestedEnergy;
private boolean allowExtraction = false;
@ -46,8 +47,9 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
public PipePowerWood(Item item) {
super(new PipeTransportPower(), item);
battery = new RFBattery(320 * 50, 320, 0);
battery = new RFBattery(320 * 50, 320 * 50, 0);
transport.initFromPipe(getClass());
receiveLimit = 320;
}
@Override
@ -104,7 +106,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
if (allowExtraction) {
allowExtraction = false;
int energyMaxExtract = Math.min(battery.getMaxEnergyExtract(), battery.getMaxEnergyStored() - battery.getEnergyStored());
int energyMaxExtract = Math.min(receiveLimit, battery.getMaxEnergyStored() - battery.getEnergyStored());
energyMaxExtract /= sources;
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
@ -197,7 +199,13 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
return maxReceive;
}
if (from.ordinal() < 6 && powerSources[from.ordinal()]) {
return battery.receiveEnergy(simulate ? Math.min(maxReceive, lastRequestedEnergy) : maxReceive, simulate);
/* Non-simulate is technically supposed to cap to maxReceive, but Forestry and RailCraft have a bug which causes
them to push energy and void it. Therefore, if a non-RF-compliant mod requests energy WITHOUT simulation, we just
accept everything verbatim.
This should be removed but probably won't. */
int maxEnergyReceive = simulate ? Math.min(receiveLimit, lastRequestedEnergy) : battery.getMaxEnergyStored();
return battery.receiveEnergy(maxEnergyReceive, simulate);
} else {
return 0;
}

View file

@ -10,6 +10,7 @@ package buildcraft.transport.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
@ -20,6 +21,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -838,7 +840,8 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
private void renderSolids(Pipe<PipeTransportItems> pipe, double x, double y, double z, float f) {
GL11.glPushMatrix();
float light = pipe.container.getWorldObj().getLightBrightness(pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord);
int skylight = pipe.container.getWorld().getSkyBlockTypeBrightness(EnumSkyBlock.Sky, pipe.container.x(), pipe.container.y(), pipe.container.z());
int blocklight = pipe.container.getWorld().getSkyBlockTypeBrightness(EnumSkyBlock.Block, pipe.container.x(), pipe.container.y(), pipe.container.z());
int count = 0;
for (TravelingItem item : pipe.transport.items) {
@ -849,15 +852,22 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
Position motion = new Position(0, 0, 0, item.toCenter ? item.input : item.output);
motion.moveForwards(item.getSpeed() * f);
doRenderItem(item, x + item.xCoord - pipe.container.xCoord + motion.x, y + item.yCoord - pipe.container.yCoord + motion.y, z + item.zCoord - pipe.container.zCoord + motion.z, light, item.color);
doRenderItem(item, x + item.xCoord - pipe.container.xCoord + motion.x, y + item.yCoord - pipe.container.yCoord + motion.y, z + item.zCoord - pipe.container.zCoord + motion.z, skylight, blocklight, item.color);
count++;
}
GL11.glPopMatrix();
}
public void doRenderItem(TravelingItem travellingItem, double x, double y, double z, float light, EnumColor color) {
private int getItemLightLevel(ItemStack stack) {
if (stack.getItem() instanceof ItemBlock) {
Block b = Block.getBlockFromItem(stack.getItem());
return b.getLightValue();
}
return 0;
}
public void doRenderItem(TravelingItem travellingItem, double x, double y, double z, int skylight, int blocklight, EnumColor color) {
if (travellingItem == null || travellingItem.getItemStack() == null) {
return;
}
@ -868,6 +878,8 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + 0.25F, (float) z);
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skylight << 4, Math.max(blocklight, getItemLightLevel(itemstack)) << 4);
if (travellingItem.hasDisplayList) {
GL11.glCallList(travellingItem.displayList);
} else {