Search in sources :

Example 1 with TileEntityIrrigationComponent

use of com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent in project AgriCraft by AgriCraft.

the class DebugModeFillIrrigationComponent method debugActionBlockClicked.

@Override
public void debugActionBlockClicked(ItemStack stack, ItemUseContext context) {
    if (context.getWorld().isRemote()) {
        return;
    }
    TileEntity tile = context.getWorld().getTileEntity(context.getPos());
    if (tile instanceof TileEntityIrrigationComponent) {
        TileEntityIrrigationComponent component = (TileEntityIrrigationComponent) tile;
        component.pushWater(component.getCapacity(), true);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityIrrigationComponent(com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent)

Example 2 with TileEntityIrrigationComponent

use of com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent in project AgriCraft by AgriCraft.

the class DebugModeCheckIrrigationComponent method debugActionBlockClicked.

@Override
public void debugActionBlockClicked(ItemStack stack, ItemUseContext context) {
    MessageUtil.messagePlayer(context.getPlayer(), "{0} Irrigation Component Info:", AgriCraft.instance.proxy().getLogicalSide());
    TileEntity tile = context.getWorld().getTileEntity(context.getPos());
    if (!(tile instanceof TileEntityIrrigationComponent)) {
        MessageUtil.messagePlayer(context.getPlayer(), "This is not an irrigation component");
    } else {
        TileEntityIrrigationComponent component = (TileEntityIrrigationComponent) tile;
        MessageUtil.messagePlayer(context.getPlayer(), " - Contents: {0}/{1}", component.getContent(), component.getCapacity());
        MessageUtil.messagePlayer(context.getPlayer(), " - Level: {0}, [{1}; {2}]", component.getLevel(), component.getMinLevel(), component.getMaxLevel());
        MessageUtil.messagePlayer(context.getPlayer(), " - Neighbours:");
        MessageUtil.messagePlayer(context.getPlayer(), "   - NORTH: {0}", component.describeNeighbour(Direction.NORTH));
        MessageUtil.messagePlayer(context.getPlayer(), "   - EAST: {0}", component.describeNeighbour(Direction.EAST));
        MessageUtil.messagePlayer(context.getPlayer(), "   - SOUTH: {0}", component.describeNeighbour(Direction.SOUTH));
        MessageUtil.messagePlayer(context.getPlayer(), "   - WEST: {0}", component.describeNeighbour(Direction.WEST));
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityIrrigationComponent(com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent)

Example 3 with TileEntityIrrigationComponent

use of com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent in project AgriCraft by AgriCraft.

the class DebugModeDrainIrrigationComponent method debugActionBlockClicked.

@Override
public void debugActionBlockClicked(ItemStack stack, ItemUseContext context) {
    if (context.getWorld().isRemote()) {
        return;
    }
    TileEntity tile = context.getWorld().getTileEntity(context.getPos());
    if (tile instanceof TileEntityIrrigationComponent) {
        TileEntityIrrigationComponent component = (TileEntityIrrigationComponent) tile;
        component.drainWater(component.getCapacity(), true);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityIrrigationComponent(com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent)

Example 4 with TileEntityIrrigationComponent

use of com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent in project AgriCraft by AgriCraft.

the class AgriWailaIrrigationBlockInfoProvider method appendBody.

@Override
public void appendBody(List<ITextComponent> tooltip, IDataAccessor accessor, IPluginConfig config) {
    TileEntity tile = accessor.getTileEntity();
    if (tile instanceof TileEntityIrrigationComponent) {
        if (tile instanceof TileEntityIrrigationChannel) {
            TileEntityIrrigationChannel channel = (TileEntityIrrigationChannel) tile;
            if (channel.hasValve()) {
                if (channel.isOpen()) {
                    tooltip.add(AgriToolTips.VALVE_INFO_OPEN);
                } else {
                    tooltip.add(AgriToolTips.VALVE_INFO_CLOSED);
                }
            }
        }
        TileEntityIrrigationComponent component = (TileEntityIrrigationComponent) tile;
        tooltip.add(new StringTextComponent(component.getContent() + " / " + component.getCapacity() + " mB"));
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityIrrigationChannel(com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationChannel) StringTextComponent(net.minecraft.util.text.StringTextComponent) TileEntityIrrigationComponent(com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent)

Example 5 with TileEntityIrrigationComponent

use of com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent in project AgriCraft by AgriCraft.

the class TileEntityIrrigationChannelRenderer method drawConnectionEast.

protected void drawConnectionEast(ITessellator tessellator, TileEntityIrrigationChannel tile, float partialTicks) {
    TileEntityIrrigationComponent component = tile.getNeighbour(Direction.EAST);
    if (component == null) {
        return;
    }
    float y1 = tile.getRenderLevel(partialTicks) - tile.getPos().getY();
    float y2 = this.getConnectionLevel(tile, component, partialTicks);
    if (dontRenderConnection(tile, component, y2)) {
        return;
    }
    if (tile.isClosed()) {
        y1 = y2;
    }
    float minX = 10;
    float maxX = 16;
    float minZ = 6;
    float maxZ = 10;
    tessellator.addScaledVertexWithUV(maxX, Constants.WHOLE * y2, minZ, this.getWaterTexture(), maxX, minZ);
    tessellator.addScaledVertexWithUV(minX, Constants.WHOLE * y1, minZ, this.getWaterTexture(), minX, minZ);
    tessellator.addScaledVertexWithUV(minX, Constants.WHOLE * y1, maxZ, this.getWaterTexture(), minX, maxZ);
    tessellator.addScaledVertexWithUV(maxX, Constants.WHOLE * y2, maxZ, this.getWaterTexture(), maxX, maxZ);
}
Also used : TileEntityIrrigationComponent(com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent)

Aggregations

TileEntityIrrigationComponent (com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationComponent)9 TileEntity (net.minecraft.tileentity.TileEntity)5 TileEntityIrrigationChannel (com.infinityraider.agricraft.content.irrigation.TileEntityIrrigationChannel)2 ProgressStyle (mcjty.theoneprobe.apiimpl.styles.ProgressStyle)1 StringTextComponent (net.minecraft.util.text.StringTextComponent)1