Fixs for the PersistentWorld removal. Thanks psx
This commit is contained in:
parent
f1b9e30d88
commit
7150cbb30f
5 changed files with 49 additions and 20 deletions
buildcraft_client/net/minecraft/src
common/net/minecraft/src/buildcraft
|
@ -17,6 +17,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.src.buildcraft.api.IBlockPipe;
|
||||
import net.minecraft.src.buildcraft.api.IPipe;
|
||||
import net.minecraft.src.buildcraft.api.IPipe.DrawingState;
|
||||
import net.minecraft.src.buildcraft.api.IPipeTile;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.core.ClassMapping;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
|
@ -31,6 +32,7 @@ import net.minecraft.src.buildcraft.core.RenderEntityBlock;
|
|||
import net.minecraft.src.buildcraft.core.RenderLaser;
|
||||
import net.minecraft.src.buildcraft.core.RenderRobot;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
import net.minecraft.src.buildcraft.transport.TileGenericPipe;
|
||||
import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
import net.minecraft.src.forge.NetworkMod;
|
||||
|
||||
|
@ -133,11 +135,13 @@ public class mod_BuildCraftCore extends NetworkMod {
|
|||
} else if (block.getRenderType() == BuildCraftCore.pipeModel) {
|
||||
|
||||
TileEntity tile = iblockaccess.getBlockTileEntity(i, j, k);
|
||||
|
||||
if (tile == null || !(tile instanceof IPipe))
|
||||
|
||||
if (tile != null && tile instanceof IPipeTile && ((IPipeTile)tile).isInitialized()) {
|
||||
pipeRender(renderblocks, iblockaccess, tile, block, l);
|
||||
}
|
||||
else {
|
||||
legacyPipeRender(renderblocks, iblockaccess, i, j, k, block, l);
|
||||
else
|
||||
pipeRender(renderblocks, iblockaccess, tile, (IPipe) tile, block, l);
|
||||
}
|
||||
|
||||
} else if (block.getRenderType() == BuildCraftCore.oilModel)
|
||||
renderblocks.renderBlockFluids(block, i, j, k);
|
||||
|
@ -145,12 +149,15 @@ public class mod_BuildCraftCore extends NetworkMod {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void pipeRender(RenderBlocks renderblocks, IBlockAccess iblockaccess, TileEntity tile, IPipe pipe, Block block, int l) {
|
||||
private void pipeRender(RenderBlocks renderblocks, IBlockAccess iblockaccess, TileEntity tile, Block block, int l) {
|
||||
|
||||
ITileBufferHolder holder = (ITileBufferHolder) tile;
|
||||
|
||||
float minSize = Utils.pipeMinPos;
|
||||
float maxSize = Utils.pipeMaxPos;
|
||||
|
||||
IPipe pipe = ((TileGenericPipe)tile).pipe;
|
||||
|
||||
pipe.setDrawingState(DrawingState.DrawingPipe);
|
||||
|
||||
pipe.prepareTextureFor(Orientations.Unknown);
|
||||
|
|
17
common/net/minecraft/src/buildcraft/api/IPipeTile.java
Normal file
17
common/net/minecraft/src/buildcraft/api/IPipeTile.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.minecraft.src.buildcraft.api;
|
||||
|
||||
public interface IPipeTile {
|
||||
|
||||
IPipe getPipe();
|
||||
|
||||
boolean isInitialized();
|
||||
}
|
|
@ -90,7 +90,7 @@ public class Pipe implements IPipe, IDropControlInventory {
|
|||
|
||||
}
|
||||
|
||||
public void setPosition(int xCoord, int yCoord, int zCoord) {
|
||||
private void setPosition(int xCoord, int yCoord, int zCoord) {
|
||||
this.xCoord = xCoord;
|
||||
this.yCoord = yCoord;
|
||||
this.zCoord = zCoord;
|
||||
|
@ -99,7 +99,7 @@ public class Pipe implements IPipe, IDropControlInventory {
|
|||
logic.setPosition(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public void setWorld(World worldObj) {
|
||||
private void setWorld(World worldObj) {
|
||||
if (worldObj != null && this.worldObj == null) {
|
||||
this.worldObj = worldObj;
|
||||
transport.setWorld(worldObj);
|
||||
|
|
|
@ -23,8 +23,10 @@ import net.minecraft.src.buildcraft.api.APIProxy;
|
|||
import net.minecraft.src.buildcraft.api.EntityPassiveItem;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers;
|
||||
import net.minecraft.src.buildcraft.api.IPipe;
|
||||
import net.minecraft.src.buildcraft.api.IPipeConnection;
|
||||
import net.minecraft.src.buildcraft.api.IPipeEntry;
|
||||
import net.minecraft.src.buildcraft.api.IPipeTile;
|
||||
import net.minecraft.src.buildcraft.api.IPowerReceptor;
|
||||
import net.minecraft.src.buildcraft.api.ISpecialInventory;
|
||||
import net.minecraft.src.buildcraft.api.LiquidSlot;
|
||||
|
@ -47,7 +49,7 @@ import net.minecraft.src.buildcraft.core.network.PacketTileUpdate;
|
|||
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
||||
|
||||
public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiquidContainer, ISpecialInventory, IPipeEntry,
|
||||
ISynchronizedTile, IOverrideDefaultTriggers, ITileBufferHolder, IPipeConnection, IDropControlInventory {
|
||||
IPipeTile, ISynchronizedTile, IOverrideDefaultTriggers, ITileBufferHolder, IPipeConnection, IDropControlInventory {
|
||||
|
||||
public TileBuffer[] tileBuffer;
|
||||
public boolean[] pipeConnectionsBuffer = new boolean[6];
|
||||
|
@ -78,15 +80,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
|
||||
int key = nbttagcompound.getInteger("pipeId");
|
||||
if (key > 0) {
|
||||
pipe = BlockGenericPipe.createPipe(key);
|
||||
}
|
||||
pipe = BlockGenericPipe.createPipe(key);
|
||||
|
||||
if (pipe != null) {
|
||||
|
||||
pipe.setTile(this);
|
||||
pipe.readFromNBT(nbttagcompound);
|
||||
}
|
||||
}
|
||||
|
@ -180,12 +179,21 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
|
|||
if (!pipeBound && pipe != null) {
|
||||
|
||||
pipe.setTile(this);
|
||||
pipe.setWorld(worldObj);
|
||||
|
||||
pipeId = pipe.itemID;
|
||||
pipeBound = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPipe getPipe() {
|
||||
return pipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPowerProvider(PowerProvider provider) {
|
||||
|
@ -350,13 +358,11 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
|
|||
*/
|
||||
@Override
|
||||
public void handleDescriptionPacket(PacketUpdate packet) {
|
||||
|
||||
if (pipe == null && packet.payload.intPayload[0] != 0) {
|
||||
|
||||
pipe = BlockGenericPipe.createPipe(packet.payload.intPayload[0]);
|
||||
pipeBound = false;
|
||||
bindPipe();
|
||||
|
||||
if (pipe != null)
|
||||
pipe.initialize();
|
||||
initialize(pipe);
|
||||
|
||||
// Check for wire information
|
||||
pipe.handleWirePayload(packet.payload, new IndexInPayload(1, 0, 0));
|
||||
|
|
|
@ -107,7 +107,6 @@ public class PipeItemsStripes extends Pipe implements IItemTravelingHook, IPower
|
|||
|
||||
Pipe newPipe = BlockGenericPipe.createPipe(data.item.item.itemID);
|
||||
newPipe.setTile(this.container);
|
||||
newPipe.setWorld(worldObj);
|
||||
this.container.pipe = newPipe;
|
||||
((PipeTransportItems) newPipe.transport).travelingEntities = (TreeMap<Integer, EntityData>) pipe.travelingEntities
|
||||
.clone();
|
||||
|
|
Loading…
Add table
Reference in a new issue