use of crazypants.enderio.base.conduit.IConduit in project EnderIO by SleepyTrousers.
the class AbstractConduit method onAfterRemovedFromBundle.
@Override
public void onAfterRemovedFromBundle() {
TileEntity te = getBundle().getEntity();
World world = te.getWorld();
for (EnumFacing dir : conduitConnections) {
IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
if (neighbour instanceof IServerConduit) {
((IServerConduit) neighbour).conduitConnectionRemoved(dir.getOpposite());
((IServerConduit) neighbour).connectionsChanged();
}
}
conduitConnections.clear();
if (!externalConnections.isEmpty()) {
world.notifyNeighborsOfStateChange(te.getPos(), te.getBlockType(), true);
}
externalConnections.clear();
IConduitNetwork<?, ?> network = getNetwork();
if (network != null) {
network.destroyNetwork();
}
connectionsChanged();
}
use of crazypants.enderio.base.conduit.IConduit in project EnderIO by SleepyTrousers.
the class AbstractConduitNetwork method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (IConduit con : conduits) {
sb.append(con.getBundle().getLocation());
sb.append(", ");
}
return "AbstractConduitNetwork@" + Integer.toHexString(hashCode()) + " [conduits=" + sb.toString() + "]";
}
use of crazypants.enderio.base.conduit.IConduit in project EnderIO by SleepyTrousers.
the class BlockConduitBundle method getPickBlock.
@Override
@Nonnull
public ItemStack getPickBlock(@Nonnull IBlockState bs, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) {
ItemStack ret = ItemStack.EMPTY;
if (target.hitInfo instanceof CollidableComponent) {
CollidableComponent cc = (CollidableComponent) target.hitInfo;
TileConduitBundle bundle = getTileEntity(world, pos);
if (bundle != null) {
IConduit conduit = bundle.getConduit(cc.conduitType);
if (conduit != null) {
ret = conduit.createItem();
} else if (cc.conduitType == null && bundle.hasFacade()) {
bundle.getFacadeType();
// use the facade
ret = new ItemStack(ModObject.itemConduitFacade.getItemNN(), 1, EnumFacadeType.getMetaFromType(bundle.getFacadeType()));
PaintUtil.setSourceBlock(ret, bundle.getPaintSource());
}
}
}
return ret;
}
use of crazypants.enderio.base.conduit.IConduit in project EnderIO by SleepyTrousers.
the class AbstractConduit method onAddedToBundle.
@Override
public void onAddedToBundle() {
TileEntity te = bundle.getEntity();
World world = te.getWorld();
conduitConnections.clear();
for (EnumFacing dir : EnumFacing.VALUES) {
IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
if (neighbour instanceof IServerConduit && ((IServerConduit) neighbour).canConnectToConduit(dir.getOpposite(), this)) {
conduitConnections.add(dir);
((IServerConduit) neighbour).conduitConnectionAdded(dir.getOpposite());
((IServerConduit) neighbour).connectionsChanged();
}
}
externalConnections.clear();
for (EnumFacing dir : EnumFacing.VALUES) {
if (!containsConduitConnection(dir) && canConnectToExternal(dir, false)) {
externalConnectionAdded(dir);
}
}
connectionsChanged();
}
use of crazypants.enderio.base.conduit.IConduit in project EnderIO by SleepyTrousers.
the class BlockConduitBundle method addHitEffects.
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World world, @Nonnull RayTraceResult target, @Nonnull ParticleManager effectRenderer) {
TileConduitBundle cb = getTileEntity(world, target.getBlockPos());
if (cb == null) {
return false;
}
TextureAtlasSprite tex = null;
if (YetaUtil.isSolidFacadeRendered(cb, Minecraft.getMinecraft().player)) {
IBlockState paintSource = cb.getPaintSource();
if (paintSource != null) {
tex = RenderUtil.getTexture(paintSource);
}
} else if (target.hitInfo instanceof CollidableComponent) {
CollidableComponent cc = (CollidableComponent) target.hitInfo;
IConduit con = cb.getConduit(cc.conduitType);
if (con != null && con instanceof IClientConduit.WithDefaultRendering) {
tex = ((IClientConduit.WithDefaultRendering) con).getTextureForState(cc);
}
}
if (tex == null) {
tex = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(ModObject.block_machine_base.getBlockNN().getDefaultState());
}
lastHitIcon = tex;
addBlockHitEffects(world, effectRenderer, target.hitVec.x, target.hitVec.y, target.hitVec.z, target.sideHit, tex);
return true;
}
Aggregations